Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search query problem

Status
Not open for further replies.

ZOR

Technical User
Joined
Jan 30, 2002
Messages
2,963
Location
GB
I though this query problem was dead and buried, however user complaining its ommiting records. It searches a field of text named comments. If the user types in a word eg "Swimming" then it should retrieve all records where the word swimming appears, whether at the front, middle, end of the text. I have tried sevral attempts the last being:

& "WHERE (TXCLIPS.Comments Like '" & Me![LNAME14].Caption & "*' OR TXCLIPS.Comments Like '*, " & Me![LNAME14].Caption & "*')" _

Any ideas, thanks
 
Why not just:
Code:
WHERE TXCLIPS.Comments LIKE '*" & Me![LNAME14].Caption & "*'"

Like works like this:

LIKE *AC - finds all words that END in AC
Lilac
Prozac

Like AC* - finds all words that BEGIN in AC
Access
Account

LIKE *AC* - finds all words that CONTAIN AC
Access
Account
Lilac
Prozac
Back
Pack

Leslie

Essential for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Thanks. However using this:

& "WHERE TXCLIPS.Comments LIKE '*" & Me![LNAME14].Caption & "*'" _

If I type the word "Go" it brings up records with having more than go, ie good, goal etc.

I tried Go, and used the space bar but it still brought up goal etc.

Thanks
 
that's because both of those words contain the letter combination GO (did you not understand the explanation above?)

good
goal

it will also find words like:

ago
algorithym

now the chances of a word containing the letter combination "swimming" are probably not as common as words containing the go letter combination.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top