I have the following code which allows me to search for a client by Id Number -- however we now wish to search by client name preferably Surname & First name. I have had a go at this & can adapt the code to search on Surname but this will only bring up the first record. Is it going to be easy to change this code so that we can search on First Name & Surname (or Surname First Name) or would new code be better. And how would I do this? Any help would be great
Am using Windows XP & Access 2000
Am using Windows XP & Access 2000
Code:
Private Sub Command53_Click() Dim strClientIdNo As String Dim strSearch As String If IsNull(Me![Text54]) Or (Me![Text54]) = "" Then MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!" Me![Text54].SetFocus Exit Sub End If DoCmd.ShowAllRecords DoCmd.GoToControl ("Client_Id_No") DoCmd.FindRecord Me!Text54 Client_Id_No.SetFocus strClientIdNo = Client_Id_No.Text Text54.SetFocus strSearch = Text54.Text If strClientIdNo = strSearch Then MsgBox "Match Found For: " & strSearch, , "Congratulations!" Client_Id_No.SetFocus Text54 = "" Else MsgBox "Match Not Found For: " & strSearch & " - Please Try Again.", _ , "Invalid Search Criterion!" Text54.SetFocus End If End Sub
Comment