I created two Command buttons in a form, one to preview the entire report and one to "cancel" or exit the form. They both work. I'm trying to create a third Command button to select/filter data from the report. My code to filter the data is:
Private Sub SelectedContrac t_Click()
On Error GoTo Err_SelectedCon tract_Click
strFilter = "[LeaseMasterCont ractId] = '" & Me![LeaseMasterCont ractId] & "'"
DoCmd.OpenRepor t "OPTIMIZEIT-Audit1", acViewPreview, , strFilter
Exit_SelectedCo ntract_Click:
Exit Sub
Err_SelectedCon tract_Click:
MsgBox Err.Description
Resume Exit_SelectedCo ntract_Click
End Sub
I get the error message "Cannot find the field 'LeaseMasterCon tractId' referred to in your expression." I know the field name and report name are correct. I'm not very knowledgeable about VBA so I appreciate any help you can provide.
Krazy
Private Sub SelectedContrac t_Click()
On Error GoTo Err_SelectedCon tract_Click
strFilter = "[LeaseMasterCont ractId] = '" & Me![LeaseMasterCont ractId] & "'"
DoCmd.OpenRepor t "OPTIMIZEIT-Audit1", acViewPreview, , strFilter
Exit_SelectedCo ntract_Click:
Exit Sub
Err_SelectedCon tract_Click:
MsgBox Err.Description
Resume Exit_SelectedCo ntract_Click
End Sub
I get the error message "Cannot find the field 'LeaseMasterCon tractId' referred to in your expression." I know the field name and report name are correct. I'm not very knowledgeable about VBA so I appreciate any help you can provide.
Krazy
Comment