I want to create a list of all tables in an ms Access database including those that are hidden.
+2
A:
The following will print the name of each table to the immediate window.
Sub ShowAllTables()
Dim obj As AccessObject
For Each obj In Application.CurrentData.AllTables
Debug.Print obj.Name
Next obj
End Sub
Curtis Inderwiesche
2009-05-20 23:49:45
You should exclude System tables - they start with MSys - from any actions on tables, tampering with system tables can permanently damage or destroy your database. If Left(obj.Name,4) <> "Msys" Then 'Do stuffEnd If
Remou
2009-05-21 10:27:26
+1
A:
I don't know whether an AccessObject can tell you whether the table is hidden but ADO certainly can e.g.
Sub ShowAllTables2()
Dim cat
Set cat = CreateObject("ADOX.Catalog")
With cat
.ActiveConnection = CurrentProject.Connection
Dim t
For Each t In .tables
Debug.Print t.Name, t.Properties("Jet OLEDB:Table Hidden In Access").Value
Next
End With
End Sub
onedaywhen
2009-05-21 07:13:13