Using "like" from an external link

A

akadas

Hi,

I am connecting into an Access 2007 database that I set up, and one of my queries uses the "like" keyword. The query runs fine within access but if I connect to it externally (say through ADO or something setting it up in my window's ODBC list) the same query returns nothing.

I checked the query without using wildcards in the "like" quote (such as *)and then the query worked as if I was using an "=" clause. Of course I do not want that.

Has anyone faced this issue before?

Thanks
 
B

Bob Barrows

Hi,

I am connecting into an Access 2007 database that I set up, and one
of my queries uses the "like" keyword. The query runs fine within
access but if I connect to it externally (say through ADO or
something setting it up in my window's ODBC list) the same query
returns nothing.

I checked the query without using wildcards in the "like" quote (such
as *) and then the query worked as if I was using an "=" clause. Of
course I do not want that.

Has anyone faced this issue before?

Thanks

Yep. External technologies, such as ADO, require ODBC wildcards (% and _
instead of * and ?) to be used in the queries sent to them. The provider
being used determines what it does with the wildcards in the query. In the
case of the Jet provider (or the ODBC driver for Jet) the wildcards are
replaced with the Jet wildcards before being passed to the databse engine.

Corollary: if you use an external technology to execute a Jet saved query
that contains wildcards, the same thing will occur. This one had me
scratching my head for quite some time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top