View Full Version : Running Query With Like In Ado


jaydwest
07-29-2006, 04:20 PM
Well Shut down my computer and call me a newbie.

I'm trying to run an append query with two parameters and a like "value*" in the where clause. When I run it in ADO it returns no values.

When I run it in DAO is works just fine.

WHen I delete the like condition it works just fine.

When I change the like condition to and abolute condition, e.g. "Cancel" it works just fine.

BUT WHEN I PUT Like "Can*" back it is returns no records.

Now I've been working with Access for more years than I will admit, but I have never seen anything like this.

I assume Like is valid SQL

SO SOMEONE PUT ME OUT OF MY MISERY. Am I barking up the wrong dog, or is "Like 'XXX*" not usable when executing queries in ADO.

SAVE ME !!!!! SAVE ME!!!!

elbweb
07-29-2006, 04:26 PM
use a percent sign instead of a asterisk :-P (i'm pretty sure?)

Pat Hartman
07-31-2006, 10:44 PM
Access uses a different set of wildcards than other SQL implementations. So, I believe that elbweb is correct. Change your wildcard.

jaydwest
08-01-2006, 06:31 AM
Pat,

I tried that and it doesn't work. I believe the % wild card is used for SQL Server but not for Access.

I haven't had a chance to research this further but when I do I will post a resolution.

Thanks.

Brianwarnock
08-01-2006, 07:03 AM
This is from microsoft help and support

Rather than using the asterisk (*) and question mark (?) symbols as wildcards, ADO requires that you use the percent sign (%) to match multiple characters and the underscore (_) to match a single character. There's no single-digit wildcard available through ADO that equates to DAO's pound sign wildcard (#); however, character lists and ranges behave the same.

What was interesting was that to use the ADO wild cards in your design grid you can use ALike instead of Like, just another undocumented feature.

Not that any of the above seems to help you.

Brian

pdx_man
08-01-2006, 12:22 PM
Try using single quotes instead of double, and use the %.

clubcar
12-16-2007, 03:58 PM
This is from microsoft help and support



What was interesting was that to use the ADO wild cards in your design grid you can use ALike instead of Like, just another undocumented feature.

Not that any of the above seems to help you.

Brian

You are a genius...

I was trying to get ADO with Transform statement pulling into excel to work. When my query was using *, it failed, continually. I was going to go with Left([item],4) = xxxx... but what a pain to keep up... instead, I used Alike (never heard of it) and %... and I'll be darned, my SQL now works...
that was a frustrating 40 hrs spent researching and testing... now solved.

Brianwarnock
12-17-2007, 03:42 AM
What is it they say, genius is 99% perspiration, well you're on the way since you obviously searched the forum, something too many don't bother to do.
Glad the old thread helped.

Brian

AC5FF
12-17-2007, 12:35 PM
[QUOTE=jaydwest;510327]Well Shut down my computer and call me a newbie.
[//QUOTE]

I couldn't of said that better for this question:

Can someone enlighten me to what these acronyms are??
ADO
DAO

Thx

pbaldy
12-17-2007, 12:39 PM
Good info here:

http://www.mdbmakers.com/forums/showthread.php?t=2606

AC5FF
12-17-2007, 12:57 PM
Kewl;
Thanks pbaldy..

AC