I'm trying to do a macro that lists all tables in a accessdb, so far I've got to this which doesnt work:
Dim cnn As ADODB.Connection
'Dim myTable As ADODB.Table
Set cnn = New ADODB.Connection
.CursorLocation = adUseServer
.ConnectionTimeout = 500
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=C:\Database.accdb"
.CommandTimeout = 500
For Each myTable In cnn.Tables
If myTable.Type <> "VIEW" And _
myTable.Type <> "SYSTEM TABLE" And _
myTable.Type <> "ACCESS TABLE" Then MsgBox myTable.Name
Set cnn = Nothing
I get an error on "For Each myTable In cnn.Tables". Am i missing something here?
What I'll be trying next is once a table has been selected that all columns in that table is shown
Does anyone have any suggestions to how to fix this?
Thank you in advance!