trying to make a relitively diecent search

  • Thread starter Mario Cirillo via AccessMonster.com
  • Start date
M

Mario Cirillo via AccessMonster.com

Hello all

I have a criteria like this in my query

Like "*" & Forms![Form1]![searchField] & "*"

Basically it will return any record which contain the word which is typed in
the search field. This works fine if only one word is typed in. I was
wondering if anyone knew how i could break down the string that is typed in
the search so the criteria would take each word in tern and see if it appears
(Like). So it would be a and or as opposed to just or as a field could
contain one of the words or both of the words.

If that makes any sence?
Any feedback would be greatly appriciated.
Thanks
Mario
 
D

Duane Hookom

You could consider creating a table (tblWords) with a single field (Word) of
search words where a user could enter in as many words/records as they like.
Add this table to your query and set the criteria to:

Like "*" & tblWords.Word & "*"

This has some limitations but would work for reports and searching.
 
M

Mario Cirillo via AccessMonster.com

Hello thanks for that idea but not to sure how i would implement that and how
practical it would be?
i mean a user will enter a string such as

insurance companies
so i would need something that woudl break the string down into words on the
fly and then use the like statement with an OR paramater so it would analyse
each word entered in that particular field on my query, but my access
knowledge is limited and im not sure how to do this
 
D

Duane Hookom

Your users could enter the search words into a subform bound to the table of
search words. You could clear the entire table by running a delete query.
Users would enter as many words as they like:
insurance
companies
company
incorporated
...
 
Top