ListTables Method (Professional Edition Only)

See AlsolanListTablesSee                 ExamplelanListTablesX>Low


Creates a Snapshot1ZLURBC with one record for each Table3N276AP or QueryDef19G3DMW in a specified database3GGA17.


Note   It is much easier and more efficient to use the TableDefs collection2CHOSZ 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.



Set snapshot = database.ListTables( )


The ListTables method uses these parts:

Part                 Description


snapshot          An object variableZ3R9Q5 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 Null1DDW7C0.

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 table10DEL8 in the Attributes property topic.

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.