keyword search function

G

Guest

I have a keyword search function in the criteria row of my query that reads:
Like "*" & [forms]![frmSearchByKeyword]![ThisValue1] & "*"

However, in this format, it does not look for only the exact value in
ThisValue1, but any matches. For example, if you type in pension, the query
will also pick up suspension. Is there another set of quotes needed to fix
this problem?

Thanks.
 
A

Allen Browne

If one record can have multiple keywords associated with it, you need to
create another table where you can have a related record for each keyword.
For example if article 93 has keywords 'pension' and 'health', the table
would have these 2 records:
ArticleID Keyword
===============
93 pension
93 health
You can now search for the keywords without the need to use wildcards, and
get instantaneous results.

For an example of how to find the records that have a match in the keywords
subform, see:
http://allenbrowne.com/ser-28.html
Alternatively, a subquery might help:
http://allenbrowne.com/subquery-01.html

If you don't want to do that, but you still want to distinguish separate
words, you need to investigate how to program regular expressions. Here's a
starting point:
http://www.j.nurick.dial.pipex.com/Code/vbRegex/rgxExtract.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top