When you use the ADO object model to iterate through the
Tables collection of an Access database, the names of queries will be included as part of the collection.
When you use the ADO object model to iterate through the
Tables collection of an Access project, the names of views will be included as part of the collection.
Steps To Reproduce Behavior
- Open the sample database Northwind.mdb or the sample Access project NorthwindCS.adp.
- Insert a new module.
- On the Tools menu, click References, and select the following references if they are not already selected (checked):
- Microsoft ActiveX Data Objects 2.1 Library
- Microsoft ADO Ext. 2.1 for DDL and Security
- Type the following ADO code:
Sub FindTables()
Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
cat.ActiveConnection = CurrentProject.Connection
For Each tbl In cat.Tables
Debug.Print tbl.Name
Next tbl
End Sub
- Type the following line in the Immediate window, and then press ENTER:
Note that the Immediate window lists tables, along with queries or views.