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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QUERY TO MATCH ANY AND ALL CHARACTERS II

Status
Not open for further replies.

baybie

IS-IT--Management
Oct 5, 2002
68
GB
Hello does anyone know of a parameter query which can look for a match to any or all of the characters typed in. at the moment i use the query Like [First few letters of Title] & "*"
This seems to oonly be useful for looking up names etc. Any ideas?

I WAS GIVEN THE FOLLOWING:

DEK25 (Programmer) Nov 24, 2002
try LEFT([FieldName],[Length]) or try MID() and RIGHT


lhite (TechnicalUser) Nov 25, 2002
In the query's criteria type:
Like "*" & [FieldValue] & "*"

Thus, if the field is a last name field and the user types in "Smith" it will return Smith, Smith-Jones, Walker-Smith, etc.

-Larry

I have tried these but the first gives me the same results that i had with my first query Like [First few letters of Title] & "*" While the second doesn't work.


 

Where
InStr(1, yourfield, "Smith", vbTextCompare) > 0

This starts at 1 looking for your string, if it finds it then it returns the starting position. So, if it is greater than zero it found the string. Although the like should work.

Where
yourfield like "*smith*"

Try these with the literal to see how they work and then build one of them into your sql string that you are going to execute.
 
Did you try this format .... should work fine
Like "*" & Forms!frmnamesearch!txtname & "*"
Remember amateurs built the ark - professionals built the Titanic

[yoda]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top