Usinga single search button for mutiple text box

hemolytucus

Registered User.
Local time
Today, 11:41
Joined
Feb 20, 2014
Messages
12
Hi

I am creating search boxes within that searches customer by lastname, phone number, address and suburb. Will I be able to use one search button for all of them or do they have to be individual buttons? Any help will be greatly appreciated. Thanks
 
I assume your search button runs a query? Or perhaps displays a form or subform based on a query? If so, then you need to put something like
[Forms]![NameOfSearchForm]![NameofSearchTextBox] on the criteria line in each column of the query, but also on SEPARATE lines, working diagonally down and to the right.

Then your query will return matches where the LastName = your search text OR where the Suburb = your search text OR where the PhoneNumber = your search text etc etc.

You could also use Like "*"&[Forms]![NameOfSearchForm]![NameofSearchTextBox]&"*" if you want those fields to simply CONTAIN the text you search for, rather than match it exactly.
 
Thank you guys. I know its possible to search items from multiple fields but will I be able to use a single search box to search for a specified field:banghead:
 
Hm.
For sure, is not necessary to use a button for each textbox. You can use the "After Update" event for this textboxes in order to trigger the search procedure - no button is necessary.
But, if you need to run the search procedure after (and only AFTER) you fill all the textboxes, then you need to use a "search" button.
Under the Click event of this button you should check that all the textboxes was filled, then continue with the procedure for search job.

Note:
I said:
But, if you need to run the search procedure after (and only AFTER) you fill all the textboxes, then you need to use a "search" button.
This is the easiest approach. A more elegant one is to check, in each "After Update" events if all the textboxes was filled.
If YES then the "Search" procedure will run.
 
If I have understood your requirement correctly, then the attached example should do it. You type something in the box, hit Search and it find records where the data matches any of the fields shown.

Try entering "Jack" for example and you'll get results in the [Last name], [Forename], [Address1] and [Suburb] fields.

Is this the kind of thing you needed?

John Big Booty's sample database is great and I'll bet I can find some uses for the technique where I work, but if you need something simple, my approach is easier to understand. For me anyway ;)
 

Attachments

Users who are viewing this thread

Back
Top Bottom