P
patrick tz
I am trying to search my data table based on two or more search criteria that
will open a seperate form with a command button. I have already created a
unbound form and added a command button that will allow me to search based on
a single field and have viewed the code in vba and tried to add in a second
serch field and when i try the command button i recieve a "mismatch type"
error message.
I am able to change the fields around and get the command button based on a
single field but when i add in a second field it will not work.
this is what i have so far:
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim STLINKCRITERIA1 As String
stDocName = "MCHUGH"
STLINKCRITERIA1 = "[FNAME]=" & "'" & Me![first] & "'"
stLinkCriteria = "[LNAME]=" & "'" & Me![last] & "'"
DoCmd.OpenForm stDocName, , , STLINKCRITERIA1
Exit_Command18_Click:
Exit Sub
Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click
End Sub
thank you for your help
will open a seperate form with a command button. I have already created a
unbound form and added a command button that will allow me to search based on
a single field and have viewed the code in vba and tried to add in a second
serch field and when i try the command button i recieve a "mismatch type"
error message.
I am able to change the fields around and get the command button based on a
single field but when i add in a second field it will not work.
this is what i have so far:
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim STLINKCRITERIA1 As String
stDocName = "MCHUGH"
STLINKCRITERIA1 = "[FNAME]=" & "'" & Me![first] & "'"
stLinkCriteria = "[LNAME]=" & "'" & Me![last] & "'"
DoCmd.OpenForm stDocName, , , STLINKCRITERIA1
Exit_Command18_Click:
Exit Sub
Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click
End Sub
thank you for your help