Greetings all,
How can I use ADODB to return all tables in an access DB chosen by the
user?
I'm able so far to select the DB file and build up my connect string,
but I would like to offer a list of tables withing the DB and allow
the user to choose.
Is this possible using MS ActiveX Data Objects 2.0 Library or do I
need to use a a newer version. Also what is the syntax? I have tried
adorecordset.movenext or .movefirst but get a parameter error.
If anyone has a solution or even a code snippet I would be extremely
grateful.
Cheers,
Dave.
Dim adoConnection As ADODB.Connection
Dim adoRecordset As ADODB.Recordset
Dim connectString As String
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
Set adoConnection = New ADODB.Connection
Set adoRecordset = New ADODB.Recordset
Let connectString = "Provider=microsoft.jet.oledb.3.51;" & _
"Data Source=" & CommonDialog1.FileName
End If
Debug.Print connectString
adoConnection.Open connectString
'adoRecordset.Open "Publishers", adoConnection
adoRecordset.Open "Publishers", adoConnection
Do Until adoRecordset.EOF
List1.AddItem adoRecordset!Name
adoRecordset.MoveNext
Loop
adoRecordset.Close
adoConnection.Close
Set adoRecordset = Nothing
Set adoConnection = Nothing