I'm using the following code to Populate a ListBox, but when I call this function List on a Command Button's click event, it does not populate the ListBox & during run time I checked the value of Recordcount it shows -1. I have a Access Database which has 4 tables that I'm trying to access...Any suggestions!!!
VB Code:
Priavte Function List() Dim Max As Long conDB Set oRs = New ADODB.Recordset oRs.Open "PDetails", goCnn, dOpenKeyset, adLockOptimistic Max = oRs.RecordCount oRs.Move BOF List1.Clear For I = 1 To Max List1.AddItem oRs!Name & "," & oRs("E-Mail") oRs.MoveNext Next I End Funtion
VB Code:
Public Function conDB() Set goCnn = New ADODB.Connection goCnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB5.mdb;" goCnn.Open End Function




Reply With Quote