statler01
asked on
Need VBA code for search button
I'm still trying to learn VBA for Access. I'm in a bit of a crunch right now and need a simple piece of code...
I have a lookup button on a form. I want to search records by name, but I want it to look at multiple fields on the table and find matches, then give me the option to select a match.
I want to look at either first_name or last_name on Tbl_People.
For instance if I type in "Joe" I want it to return the first and last name of everyone named Joe and allow me to select the record I want.
Using the automated search button allows me to lookup by first_name only. The generated code is below. I can't see where it's even looking at the table, let alone which field based on this code...
I have a lookup button on a form. I want to search records by name, but I want it to look at multiple fields on the table and find matches, then give me the option to select a match.
I want to look at either first_name or last_name on Tbl_People.
For instance if I type in "Joe" I want it to return the first and last name of everyone named Joe and allow me to select the record I want.
Using the automated search button allows me to lookup by first_name only. The generated code is below. I can't see where it's even looking at the table, let alone which field based on this code...
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Command18_Click:
Exit Sub
Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This didn't quite take care of it, but got me on the right track. I have more questions, which I will post as new.
Thanks!
Thanks!
ASKER
The form is bound to Tbl_People. I still am not sure how the generated code determines which field in the table to look at though...