Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search button to search on particular field

Status
Not open for further replies.

tizwaz

Technical User
Aug 8, 2002
437
GB
Is it possible to create a search button that will just search on one field. (I know if you click in the required field and then click a normal search button it will do that but they don't want to do that)
This is the code created by the wizard
Private Sub Search_Click()
On Error GoTo Err_Search_Click

Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Search_Click:
Exit Sub

Err_Search_Click:
MsgBox Err.Description
Resume Exit_Search_Click

End Sub

I thought maybe I could set the focus on the form so that when you click the button it automatically searches on that field but am not a coder and don't know how to go about it.
Can anyone help?
 
You are on the right track, what I do is put a small command button next to the field I want to search by.

myTextBox.SetFocus

DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Search_Click:
Exit Sub

Err_Search_Click:
MsgBox Err.Description
Resume Exit_Search_Click

This should work nicely for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top