Running Query With Like In Ado

jaydwest

JayW
Local time
Today, 10:37
Joined
Apr 22, 2003
Messages
340
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!!!!
 
use a percent sign instead of a asterisk :-P (i'm pretty sure?)
 
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.
 
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
 
Try using single quotes instead of double, and use the %.
 
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.
 
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
 
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
 

Users who are viewing this thread

Back
Top Bottom