ListFields Method (Professional Edition Only)
See Also Example
Description
Creates a Snapshot
Note It is easier and more efficient to use the Fields collection of a recordset instead of this method.
Syntax
Set snapshot = recordset.ListFields( )
Remarks
The ListFields method uses these parts:
Part Description
snapshot Object variable for the Snapshot you want to create.
recordset An object variable identifying an existing recordset containing the fields you want to list.
ListFields can return up to 255 records. The records in the Snapshot are in the same order as the fields in recordset. The following table shows the Snapshot field contents.
Field Data type Description
Name String Name of the field.
Type Long Number for the field data type. See table below.
Size Long Maximum size of the field. For Long Text and Long Binary fields (Type 11 and 12), Size is 0; for fields of Type 1 or 2, Size is 1.
Attributes Long Numeric value for one or more attributes of the field. See table below.
SourceTable String Name of the underlying table that supplied the field.
SourceField String Name of the field in the underlying table.
CollatingOrder Integer Comparison code for the current language. Use this value for the compare part of the StrComp and InStr functions.
The values and symbolic constants (from DATACONS.TXT) for the Type field in the Snapshot are:
Value Constant Description
1 DB_BOOLEAN True/False
2 DB_BYTE Byte
3 DB_INTEGER Integer
4 DB_LONG Long
5 DB_CURRENCY Currency
6 DB_SINGLE Single
7 DB_DOUBLE Double
8 DB_DATE Date/Time
10 DB_TEXT Text
11 DB_LONGBINARY Long Binary
12 DB_MEMO Memo
The values and symbolic constants (from DATACONS.TXT) for the Attributes field in the Snapshot are:
Value Constant Description
1 DB_FIELDFIXED Field is a fixed-length field.
4 DB_FIELDNOTNULL Values in field cannot be null.
16 DB_FIELDCOUNTER Field is a counter field .
32 DB_FIELDUPDATABLE Field is updatable.
You can't use the Fields collection of a Snapshot created with this method. To get the value of a specific record, you must explicitly use the name of the field.
In a Snapshot created using ListFields, you can determine field types by referring to the values in the Type field, and the Type constants defined in DATACONS.TXT. To determine field Attributes, use the values in Field Attributes and the Attributes constants defined in DATACONS.TXT.
If the QueryDef has no parameters, the Snapshot will have no records.
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.