I just spent the better half of the day trying to just populate a listbox using an ADO connection to an Access 97 database.
I figured out that you can’t just assign the RS object to the Datasource property of the listbox and expect it to populate automatically. I finally set up a loop using the AddItems Method to insert them one by one. I’m finding that it is inserting them all in one row. I verified that I do have Columns set to 2.
Here is the code. This is all being done in the load event of the form:
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
cn.Open “Provider=Microsoft.jet.oledb.3.51;” _
& “Data Source=C:DatabaseOncology.mdb”
rs.Source = “SELECT DISTINCT tblPath.MRNumber, tblPath.Seq, tblPath.Path FROM tblPath”
Set rs.ActiveConnection = cn
rs.Open , cn
With lstRM
Do While Not rs.EOF
.AddItem rs(1) & rs(2)
rs.MoveNext
Loop
End With
‘Set lstRM.DataSource = rs