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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for Employee? 1

Status
Not open for further replies.

johnharte

Technical User
Jul 26, 2001
41
GB
Hi, being new to this, I would like to Search for an Employee using a small form with 4 or 5 criteria options (Text Boxes), which the user may only enter 1 or 2 options into it, which will then return a new form with the matches displayed on it. How would I go about it?

Thanks, John
 
Thanks For you Understand at my lack of Knowledge, I am Trying.

I tried this form from the link, but kept getting the message "The Expresion After Update you entered as the event property setting produced the following error: Variable Not Defined" This form listed all my tables but thats all it did, Am I doing something wrong?

Thanks in Advance, John
 

I apologize for sending you to that link. I had not downloaded the database myself and really misunderstood the description. The form provided at MVPS cold be very useful but doesn't match your need right now.

Basically, you should create a query in the query designer. Select all of the columns you wish to see, including those you want to search. In the criteria of the search field you'll enter the names of the text boxes on your search form. The exact syntax will depend on the type of search you want to do.

Search employee name field for value in textbox1. This will search for incomplete names starting with the contents of textbox1 or all names if textbox1 is empty.
Like Forms!FormName!textbox1 & "*" Or Forms!FormName!textbox1

Search employee address field for value in textbox2. Will search for the contents of textbox2 anywhere in the address or all addresses if textbox2 is null.

You would create similar criteria in the query using all of the text boxes on your form. Make sure you use your form and text box names.
Like "*" & Forms!FormName!textbox2 & "*" Or Forms!FormName!textbox2

Save the query. Create a button on the form that opens the query. The Button code could be as simple as a single OpenQuery method of DoCmd.

DoCmd.OpenQuery ("MySearchQuery")

Check these Tek-Tips threads for more information and examples.

thread181-77049
thread701-86803 Terry Broadbent

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Terry,

Thanks for your Help, I'll try that now.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top