Works in Access not in VB 
Author Message
 Works in Access not in VB

I have a query that runs in an Access 2000 database just fine.  When I try
to run the same query on the same database from VB6 code it returns an empty
recordset.  I'm using VB6 SP5 with the ADO 2.7 library.  Any ideas?  Thanks
for the help.

   Set db = New ADODB.Connection
   cnn = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source
='c:\test\test.mdb'"
   db.Open cnn, "admin", ""

   sql = "SELECT ID, Name, Address, Phone FROM Customer WHERE Name LIKE 'A*'
AND Deleted=0;"

   rs.Open sql, cnn, adOpenForwardOnly, adLockReadOnly, adCmdText



Fri, 03 Sep 2004 09:39:04 GMT  
 Works in Access not in VB
Hi,

See my reply on your posting in data.ado newsgroup

Thanks,

val

Quote:
>-----Original Message-----
>I have a query that runs in an Access 2000 database just
fine.  When I try
>to run the same query on the same database from VB6 code
it returns an empty
>recordset.  I'm using VB6 SP5 with the ADO 2.7 library.  
Any ideas?  Thanks
>for the help.

>   Set db = New ADODB.Connection
>   cnn = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source
>='c:\test\test.mdb'"
>   db.Open cnn, "admin", ""

>   sql = "SELECT ID, Name, Address, Phone FROM Customer

WHERE Name LIKE 'A*'
Quote:
>AND Deleted=0;"

>   rs.Open sql, cnn, adOpenForwardOnly, adLockReadOnly,
adCmdText

>.



Fri, 03 Sep 2004 20:44:29 GMT  
 Works in Access not in VB
Hello,

It seems that you should modify the "*" character to "%" when you use ADO.
Please the KB article INFO: Issues Migrating from DAO/Jet to ADO/Jet
(Q225048)
at http://support.microsoft.com/default.aspx?scid=kb;EN-US;q225048.

Hope it helps!

Best regards,
Allan Sun
This posting is provided "AS IS" with no warranties, and confers to no
rights.



Sat, 04 Sep 2004 17:23:48 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Works in Access not in VB

2. SQL string not works in VB and works in Access 2000

3. VB expressions do not work properly in different installations of Access 97

4. HELP: VB 6 works with Access97 file, not Access 2000 file

5. Help: Access 2.0 Function does not work with VB 3.0

6. query works in access but not in vb

7. Access 2.0 VB 3.0 compact/repair not working

8. VB not Working with access 00 or xp

9. VB DataControl not working with Access 2000

10. Working Good in Access not workin in VB

11. Like Query Works in Access but not via VB/ADO

12. Insert works in Access query window but not from VB using JET 4.0

 

 
Powered by phpBB® Forum Software