Hello guys,
I am trying to search using 2 fields (First and Last name). I have no idea how to execute any SQL (which im sure is silly). So im using this code in a form:
DoCmd.ShowAllRecords
DoCmd.GoToRecord , , acFirst
If strLast <> "" Then
DoCmd.GoToControl "Last Name"
DoCmd.FindRecord strLast, acEntire, , acDown, , acCurrent
First_Name.SetFocus
End If
If strFirst <> "" Then
DoCmd.GoToControl "First Name"
DoCmd.FindRecord strFirst, acEntire, , acDown, , acCurrent
End If
The records are sorted Last (ASC), First (ASC). So i guessed this was the closest bet. The thing is, when the second search is done, it seems like the cursor goes back to the beginning and then searches for the First name with whatever last name is first (incorrect entry of course).
Can someone help me out do a simple AND Search using two search fields (First Name and Last Name)?
Thank You
tim
I am trying to search using 2 fields (First and Last name). I have no idea how to execute any SQL (which im sure is silly). So im using this code in a form:
DoCmd.ShowAllRecords
DoCmd.GoToRecord , , acFirst
If strLast <> "" Then
DoCmd.GoToControl "Last Name"
DoCmd.FindRecord strLast, acEntire, , acDown, , acCurrent
First_Name.SetFocus
End If
If strFirst <> "" Then
DoCmd.GoToControl "First Name"
DoCmd.FindRecord strFirst, acEntire, , acDown, , acCurrent
End If
The records are sorted Last (ASC), First (ASC). So i guessed this was the closest bet. The thing is, when the second search is done, it seems like the cursor goes back to the beginning and then searches for the First name with whatever last name is first (incorrect entry of course).
Can someone help me out do a simple AND Search using two search fields (First Name and Last Name)?
Thank You
tim