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!

How can I change my wild card criteria statement?

Status
Not open for further replies.

testkitt2

Technical User
Apr 28, 2004
193
US

I have a query that in the criteria field I use the following:

Code:
Like [Enter the first few characters to search by: ] & "*"

This will show all fields that match anything that starts with what the
user types. For example if the field has a vendor named "Universal hoses", all
you need to type is the first few characters...like "Uni" and the above vendor will show up in the query. What I'm looking for is something a bit different.
I want to use a wild card to search for any text no matter where it is. For instance...lets say I have a description field and I have this description...
"Brake shoes heavy duty". Now the above will only work if I type in "Bra" or something similiar. But what I want is to type in lets say "heavy"... something in the middle of the description. How can I change my criteria statement to search for a string in the middle instead of the first word.

any help...or suggestions is greatly appreciated.


Testkitt2
 
Add wildchard in front too

[tt]Like "*" & [Enter some characters to search by: ] & "*"[/tt]

Roy-Vidar
 
Thank RoyVidar

I tried your suggestion...
Code:
Like "*" & [Enter some characters to search by: ] & "*"
And it returned a blank query... no results.

I changed it a bit like..
Code:
Like "*" & [Enter some characters to search by: ] like & "*" 
Like "*" & [Enter some characters to search by: ]
but this returned every record. I looking to filter a keyword in the middle of a description. As I explained earlier. example..
Brake shoes heavy equipment
with the criteria code I have now if I type the first few characters of the first word " Brake " this record would be selected. what I want is to type the third word " Heavy " and the record would still be selected.

I stuck... any help is always appreciated.

Thank you
jz



Testkitt2
 
What I suggested works as you ask, at least everywhere I've used it - that's also what you've been told on at least one other site where you asked this exact same question... - so try again.

Also, this is not a Access Modules/VBA Coding question, but a SQL/query issue - forum701.

Some samples, thread701-902033, thread701-916230, thread701-849984, thread701-844026, thread701-777971...

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top