ACC2000: ActiveX Data Objects (ADO) Includes Queries and Views in the Tables Collection (225895)
The information in this article applies to:
This article was previously published under Q225895 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
SYMPTOMS
When you use ActiveX Data Objects (ADO) to programmatically traverse the Tables collection, you see the names of queries and views included as part of the collection.
RESOLUTION
Test for the type of object within the Tables collection. The table types can be:
- ACCESS TABLE
- SYSTEM TABLE
- SYSTEM VIEW
- TABLE
- VIEW
The following ADO code will only display user created tables, or tables created if you encounter import errors:
Sub FindOnlyTables()
Dim cat As New ADOX.Catalog
Dim tbl As ADOX.Table
cat.ActiveConnection = CurrentProject.Connection
For Each tbl In cat.Tables
If tbl.Type = "TABLE" Then
If tbl.Name <> "dtproperties" Then
Debug.Print tbl.Name
End If
End If
Next tbl
End Sub
STATUS
Microsoft Access 2000 uses ANSI standard SQL-92, which includes both queries and views in the Tables collection.
Modification Type: | Major | Last Reviewed: | 6/28/2004 |
---|
Keywords: | kbpending kbprb KB225895 |
---|
|