"LIKE" query problem...

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
 
V

Van T. Dinh

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

HTH
Van T. Dinh
MVP (Access)
 
Top