Re: help with sql statement
The Find property only allows you to use one criteria, instead try using the Filter property instead:
VB Code:
rs.Filter "FirstName = '" & FirstName & "'" And "LastName = '" & _
LastName & "'"
See this post
Re: help with sql statement
ok I agree
but this
VB Code:
frmCustomers.datPrimaryRS.Recordset.Filter "FirstName = '" & FirstName & "'" And "LastName = '" & _
LastName & "'"
creates a invalid use of property error
Re: help with sql statement
Quote:
Originally Posted by crater
ok I agree
but this
VB Code:
frmCustomers.datPrimaryRS.Recordset.Filter "FirstName = '" & FirstName & "'" And "LastName = '" & _
LastName & "'"
creates a invalid use of property error
Try this instead:
VB Code:
[B]datPrimaryRS.Filter[/B] "FirstName = '" & FirstName & "'" And "LastName = '" & _
LastName & "'"
Re: help with sql statement
now it's Type Mismatch
VB Code:
Private Sub cmdSearch_Click()
Dim Address As String
Dim LastName As String
Dim FirstName As String
If Len(Trim$(txtSearchBox)) = 0 Then
MsgBox "Please input a value"
txtSeachbox.SetFocus
Exit Sub
End If
If Option1 = True Then
Address = Trim$(txtSearchBox)
frmCustomers.datPrimaryRS.Recordset.MoveFirst
frmCustomers.datPrimaryRS.Recordset.Find "Address = '" & Address & "'"
End If
If Option2 = True Then
FirstName = Trim$(txtSearchBox)
LastName = Trim$(txtSearchBox)
frmCustomers.datPrimaryRS.Recordset.MoveFirst
datPrimaryRS.Recordset.Filter ("FirstName = '") & FirstName & "'" And ("LastName = '") & _
LastName & "'"
End If
Unload Me
End Sub
and I think I have to have the frmCustomer. beause this is a different form not a searchbox
but when I add it with that code I get Invalid use of Property error take it away and type mismatch error