Urrrgh!!! Am soooo annoyed! OK...figure this one out if you can...
I've got an Access 2000 database called "Phone Book.mdb" in the same directory as my program.
The database contains a table called "People" with the fields "ID", "Name" and "Notes".
There is currently 1 record in the table:
If I run the following queryCode:ID Name Notes 1 Matthew Ralstonin Access it works fine and returns 1 record. However if I run it in VB using ADO 2.1 it returns 0 records:Code:SELECT ID, Name FROM People WHERE Name LIKE 'm*'
Note that this is a simplified version of the code...the real one runs inside a loop and puts all records returned into a treeview control. I have tested the above code and the same problem occurs.Code:Dim oConn As New ADODB.Connection, oRS As New ADODB.Recordset oConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=Phone Book.mdb" oConn.Open oRS.Open "SELECT ID, Name FROM People WHERE Name LIKE '" & "m" & "*'", oConn oRS.MoveFirst Debug.Print oRS("Name") oRS.Close oConn.Close
Any ideas why?
[Edited by matthewralston on 09-12-2000 at 10:48 AM]




Reply With Quote