Find exact word matches

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using a query - I want to search for specific words within a description. So,
I want to find all descriptions of LAMP from entries like Desk Lamp, Overhead
Lamp, Bedside Lamp, etc. When I use the wildcard *lamp* I get unwanted
returns like Clamp.
What operator would determine only returning rows with the whole word Lamp
in them.

Thanks
 
Using a query - I want to search for specific words within a description. So,
I want to find all descriptions of LAMP from entries like Desk Lamp, Overhead
Lamp, Bedside Lamp, etc. When I use the wildcard *lamp* I get unwanted
returns like Clamp.
What operator would determine only returning rows with the whole word Lamp
in them.

Thanks

It will depend upon your data layout.
Add a space around the word.

Like "* lamp *"
An Overhead Lamp with shade
Lamp is in the middle of the text.

Like "* lamp"
Desk Lamp
The end of the text is Lamp

Like "Lamp *"
Lamp Shade
Lamp is at the beginning of the text.

If you wish to be prompted for the search word, use:
Like [Enter Word] & " *"
Like "* " & [Enter Word]
Like "* " & [Enter Word] & " *"
etc.
 
Try searching on * lamp* with the leading space.

Or if business rules support it, normalize your data. For example the parent
table would hold Lamp and the child table would look like:

Desk
Overhead
Bedside
Outdoor
 
If you define a word as a string surrounded by spaces, you can use.

Field: SearchThis: " " & [The field] & " "
Criteria: Like "* " & [Match What] & " *"

Note the addition of spaces at the beginning and ending of the field for
search purposes. If your definition of a word is more complex then you
would need more complex criteria. For instance
Bedside Chair/Stool

If you were to search for chair or stool as a word, you wouldn't get a
match.
 
Back
Top