Discussion Locked

MS Access Search Word Query

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a database with multiple search words. What syntax should I use that will check all of those fields and only retrieve records that have the value. EX: There are ten fields for search words, I need a query to check the value entered against all ten fields and only retrieve relevant records.

5 replies

by sl-campbell

Use in your criteria or WHERE statement of the SELECT statement the following(change the field names and criteria string accordingly):

WHERE Field1='" & strCriteria & "' OR Field2='" & strCriteria & "' OR Field2='" & strCriteria & "'"

Continuethis pattern for all fields

OR
in the query builder add the fields to show and the fileds to search on. Remove the check on the line "Show" if the fields are not to be shown.
Then add a parameter such as [Find What] including the brackets to the FIRST criteria line under the first field for the criteria, the same on the SECOND criteria line under the second field to search on, and so forth.

When you run the query, it will ask for the criteria only once in this case.

This discussion is closed to new replies.