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

Where HELP Like 'SQL string from VB'

Status
Not open for further replies.

JamieFuller

Programmer
May 2, 2001
20
GB
Hi,

I have written a front end for a Access2000 database. it works fine except using the 'LIKE' command in the SQL string. the string looks something like this

Select * FROM Table Where (Field1 LIKE 'a*');

this string works from within access (it reports all entries beginning with 'a') but from my application it doesnt work unless field1 contains EXACTLY the string after the LIKE command ie A* not every record begining with a.

Im stumped so if you can help i'll be your bestest, best friend. Or at least tell people nice things about ya!

Kindest Regards
Jamie
 

Try it with the percent sign instead of the asterisk:

Select * FROM Table Where (Field1 LIKE 'a%');


Mark
 
Mark,

THANK YOU!!!

Fast and perfectly right!.

You sir, are a god!

I shall keep my word and only say nice things about you!

But seriously, thanks alot. you have solved a major prob for me.

Kindest Regards
Jamie
 
The ('a%') will look for items starting with the letter "a".

If you use ('%a%') it will look for everything with the letter "a" in it.

Just in case. Every day above ground is a GOOD DAY!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top