ListTables Method (Professional Edition Only)
See Also Example
Description
Creates a Snapshot
Note It is much easier and more efficient to use the TableDefs collection instead of this method, which is provided for compatibility with Microsoft Access. However, it is useful for getting the names of QueryDef objects which are not otherwise available.
Syntax
Set snapshot = database.ListTables( )
Remarks
The ListTables method uses these parts:
Part Description
snapshot An object variable of type Snapshot.
database An object variable identifying an open Database containing the tables and QueryDefs you want to list. It can also be the Database property of a data control.
The following table lists the names of the Snapshot fields.
Field Data Type Description
Name String Name of the Table or QueryDef.
DateCreated Variant Date on which the Table or QueryDef was created.
LastUpdated Variant Date on which the Table or QueryDef definition was last changed.
TableType Long Number identifying the kind of Table or QueryDef. See the table below for possible values.
RecordCount Long Number of records in the Table. If TableType is DB_QUERYDEF, RecordCount is Null .
Attributes Long Number identifying one or more characteristics of each Table or QueryDef. If the Attribute is equal to DB_SYSTEMOBJECT (&H80000002) it is a system table.
The possible values for the TableType field are:
Constant Value Description
DB_TABLE &H00000001 A table.
DB_QUERYDEF &H00000005 A QueryDef.
When you use the ListTables method to create a Snapshot, you can evaluate the contents of the Attributes field in the Snapshot by referring to the TableDef property settings table
If the specified database contains no user-defined tables, and no QueryDefs, the Snapshot will include only the records of the system tables.
Other Attributes may apply to tables, but are not returned by ListTables. To examine these values, use the Attributes property of a TableDef object in the TableDefs collection of a Database.
Note The Fields collection is not available in Snapshots created by the ListTables, ListFields, ListIndexes, and ListParameters methods; therefore, you can't access the field values using an index into the Fields collection. To access the field values you must explicitly use the name of each field.
You also can't use the Find methods, such as FindFirst, on a Snapshot created with this method.