Like "*" & [Search number] & "*"

BenjaminTheBlue

Registered User.
Local time
Today, 09:05
Joined
Dec 14, 2006
Messages
14
Hiya, Just wondering if someone could help me.
I need a criteria search to search just the prefix, or from left to right when picking up a number or text. At the moment when I search on the prefix "n0" the results come back with qn0003 and other numbers similar , when i need it just to pick up N0001- onwards. Thank You in Advance Ben
 
Just take away the first * character

"like *n*" will find qn001 etc

"like n*" will find n001 etc
 
Thx Rabbie

Problem is I have lots of prefix to search on, via a button that runs a query to input text.
I need to pull lots of prefixes including 'sy', 'n0' ,'nw' and many more. I really need to be able to put in any starting letters or numbers . If I actually put "like n*" in my criteria, it wont show all sy prefix when i type sy into the text box. Hope you can help cheers Ben
 
Two ways

1.

SELECT whatever FROM whereever WHERE A LIKE "n0*" ... OR A LIKE "sy*" ... OR .....

2.

SELECT whatever FROM whereever WHERE A LIKE "n0*" UNION
SELECT whatever FROM whereever WHERE A LIKE "sy*" .... ;

In both cases, you MUST want the same WHATEVER . However, in the second case you can choose multiple WHEREEVERs depending on what you are seeking.
 
Problem is I have lots of prefix to search on, via a button that runs a query to input text.
I need to pull lots of prefixes including 'sy', 'n0' ,'nw' and many more. I really need to be able to put in any starting letters or numbers . If I actually put "like n*" in my criteria, it wont show all sy prefix when i type sy into the text box. Hope you can help cheers Ben

Not a problem. I was just using your example to illustrate the results. Of course you can use a text box to define your seach string. You may find Access help useful in framing your search strings. If you want to create your strings on the fly use some thing like.

"SELECT whatever FROM whereever WHERE A LIKE " & Searchbox
 

Users who are viewing this thread

Back
Top Bottom