If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
"LIKE" query problem...
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 |
#2
|
|||
|
|||
In ADO, the equivalent of the wild-card "*" is "%".
HTH Van T. Dinh MVP (Access) "AlexT" wrote in message oups.com... 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 |
#3
|
|||
|
|||
Wow
Thanks - just learned something ! --alexT |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Annual count queries on a field relative to a value that varies DA | tobesus | General Discussion | 7 | May 10th, 2005 07:50 AM |
Problem with query and table joins | Chuck Mueller | Running & Setting Up Queries | 1 | February 18th, 2005 04:08 PM |
adding 2 fields including null entries | Jesse | Running & Setting Up Queries | 26 | January 18th, 2005 05:31 PM |
WORD XP mail-merge FAILS using ACCESS Query | SueMackay | Mailmerge | 1 | November 23rd, 2004 01:03 PM |
Union Query Not Returning A Value | Jeff G | Running & Setting Up Queries | 2 | October 19th, 2004 05:47 PM |