N
Naz
Hi
I'm creating a macro to open a form based on two criteria. I used the wizard
to create a form opener using specific data and the tried (endlessly) to
modify to code to include 2 criteria, this is what it looks like but i kep
getting a text mismatch error.
Private Sub cmd_OpenRecord_Click()
'The arrow button to the left of the search results used to open
'the record
On Error GoTo Err_cmd_OpenRecord_Click 'Error handing, stop show error, exit
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.Minimize 'Minimise this form
stDocName = "frm_Employees" 'This is the form that will be opened
stLinkCriteria = "[PayrollNo]=" & "'" & Me![PayrollNo] & "'" And
"[jobtitle]=" & "'" & Me![JobTitle] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frm_ReturnSearchResults", acSaveNo 'Close the
return search results form
Exit_cmd_OpenRecord_Click:
Exit Sub
Err_cmd_OpenRecord_Click:
MsgBox Err.Description
Resume Exit_cmd_OpenRecord_Click
End Sub
i'm sure its my strLinkCriteria = line that is wrong does anyone know how to
correct it?
All help is appreciated.
I'm creating a macro to open a form based on two criteria. I used the wizard
to create a form opener using specific data and the tried (endlessly) to
modify to code to include 2 criteria, this is what it looks like but i kep
getting a text mismatch error.
Private Sub cmd_OpenRecord_Click()
'The arrow button to the left of the search results used to open
'the record
On Error GoTo Err_cmd_OpenRecord_Click 'Error handing, stop show error, exit
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.Minimize 'Minimise this form
stDocName = "frm_Employees" 'This is the form that will be opened
stLinkCriteria = "[PayrollNo]=" & "'" & Me![PayrollNo] & "'" And
"[jobtitle]=" & "'" & Me![JobTitle] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frm_ReturnSearchResults", acSaveNo 'Close the
return search results form
Exit_cmd_OpenRecord_Click:
Exit Sub
Err_cmd_OpenRecord_Click:
MsgBox Err.Description
Resume Exit_cmd_OpenRecord_Click
End Sub
i'm sure its my strLinkCriteria = line that is wrong does anyone know how to
correct it?
All help is appreciated.