hi all
I have been runing into a wall trying to get this statement to work
I want to be able to search DB by either Address or by the customers name.
The address search works due to help from dee-u and I can get the search for a name to work except I can't pass the SQL statement the customers whole name ie: John Smith. It will work if I change sql to LastName or FirstName . then by entering either there first or last name the search will work.
I know it's just that I don't have the sql statement right. to search both FirstName and LastName fields but I can't seem to build a correct statement.
any help
bty Thanks dee-u for the help allready

VB Code:
  1. Private Sub cmdSearch_Click()
  2. Dim Address As String
  3. Dim LastName As String
  4. Dim FirstName As String
  5.  
  6.     If Len(Trim$(txtSearchBox)) = 0 Then
  7.         MsgBox "Please input a value"
  8.         txtSeachbox.SetFocus
  9.         Exit Sub
  10.     End If
  11.  
  12.     If Option1 = True Then
  13.         Address = Trim$(txtSearchBox)
  14.         frmCustomers.datPrimaryRS.Recordset.MoveFirst
  15.         frmCustomers.datPrimaryRS.Recordset.Find "Address = '" & Address & "'"
  16.     End If
  17.     If Option2 = True Then
  18.         FirstName = Trim$(txtSearchBox)
  19.         LastName = Trim$(txtSearchBox)
  20.         frmCustomers.datPrimaryRS.Recordset.MoveFirst
  21.         frmCustomers.datPrimaryRS.Recordset.Find "FirstName = '" & FirstName & "'" And "LastName = '" & LastName & "'"
  22.     End If
  23.    
  24. Unload Me
  25. End Sub