Keyword search in query

daved2424

Registered User.
Local time
Today, 17:17
Joined
Jun 28, 2001
Messages
20
How do i make a query which will search for key words in a field in all records in a table? I have little knowledge of VBA so a way of
doing this without using it would be much appreciated.
 
Use the Like Operator in the criteria in a query.

For example, if your want to find the word Accountant in the JobTitle field in table tblEmployee, use Like "*Accountant*" in the criteria:

SELECT Employee, JobTitle
FROM tblEmployee
WHERE JobTitle LIKE "*Accountant*"


Look up Access' Help for more info on using the Like Operator.
 
I understand how to do that, but how do i make it so the user inputs 'Accountant' into something like a parameter value box so the query is hidden from the user and the value can be changed each time the query is run?
 
A query can be run either by the user or by VBA code written in event procedures triggered by the user.

If you want to hide the query from the user, you will need VBA.
 
in the criteria section of the filed you want to base the query on enter the following.
like "*"&[Enter your parameter here]&"*"

substitute "enter your parameter here" for whatever instruction or question you want the user to see.

when the query is run it will generate an input box for the user to enter the parameter the query is to run with.

eg. entry of account will return those records containing words such as accountant, accounts, accounting etc in the field your query is searching on.

the more information you enter into the input box the more refined the search will be.

im not sure if ive understood your question fully but hope this helps.

ian
 

Users who are viewing this thread

Back
Top Bottom