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

String manipulation with wildcards

Status
Not open for further replies.

DebbieCoates

Programmer
Oct 2, 2007
23
0
0
GB
can anyone spot what I am doing wrong here, i think it is becasue of the quotes I am using, but cant work out how to put them

I am using this

sSQL = "Select * from V_SOAPostCodeSearch where PCID Like '" & sPostcode & "*'"

which gives me this

Select * from V_SOAPostCodeSearch where PCID Like 's183d*'

I am trying to find everything in the V_SOAPostCodeSearch table which has a PCID starting with s183d

i dont think the wildcard is working

would appreciate any help
 
The wildcard character's depend upon the DBMS you're connecting to. If you're using Access I believe the character you're after is %:

Select * from V_SOAPostCodeSearch where PCID Like 's183d%'
 
brilliant, after hours of messing about, i swopped the * for % and it works great, many thanks
 

And since you found the wildcharacter for * it might save you time in future to know that the equivalant of DAO one character ? is ADO's _
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top