"LIKE" query problem...

  • Thread starter Thread starter AlexT
  • Start date Start date
A

AlexT

Folks

I'm having a rather strange problem with a query to an Access file
from Excel.

My query looks like

SELECT qLookups.lkSubkey, qLookups.lkValue FROM qLookups WHERE
(qINTL.lkSubkey LIKE 'Test*' )

And is spposed to return all values from qLookups where lkSubkey start
with "Test".

Now that query works exactly as expected within Access.

I also want to use it from Excel through ADO. Altough no error is
reported the query doesn't return any data.

Now the interesting part is that if I remove the LIKE clause it does
work (returning obviously all records).

My code looks like

' Create the recordset object used to load the results
Set rstProds = New ADODB.Recordset

' ...and opens the recordset
' On Error Resume Next
rstProds.Open prmTheQuery, cnnMyDb

then later does a GetRows() on the recordset


Any idea ? Must say that I am baffled...

Regards

--alexT
 
In ADO, the equivalent of the wild-card "*" is "%".

HTH
Van T. Dinh
MVP (Access)
 

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

Back
Top