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

Searching - Match part of field

Status
Not open for further replies.

Lourry

Technical User
Jul 25, 2003
84
CA
Hello All,

I have a search that is working perfectly now. It does a SQL query of the database looking for the matching result. My question is, when I do the query like:

SELECT * FROM table WHERE field = txtfield.value

it tries to match the whole value in txtfield. Is there a way to match any part of the field and not just the entire field?

Example: search for "cat" will return me "cat", "catch", "category", "cats"...

Thanks in advance!
-Lory
 
Something like this ?
strSQL = "SELECT * FROM table WHERE field Like '" & txtfield.value & "*';"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV!
"Like" was the word that I was looking for. I also used another * at the beginning so it will search for records that contains my criteria.

Thanks again for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top