PreviousActiveX Controls Guide (9.1 revision 1) Next

FieldList

Show this topic in Library frames

Applies to:

VAccess

Sets or returns a variant array containing information on the fields of the current table as specified by DdfPath and TableName.

Remarks

The FieldList property accepts and returns a variant encapsulating a two-dimensional variant array. The first subscript references one property of the field, and the second references the field ordinal. The properties referenced by the first subscript are:

Subscript
Name
Variant Type
Description
0
fieldID
VT_I2
Unique key for field table dictionary entry.
1
fieldname
VT_BSTR
Name of the field, 20 characters max storage limit.
2
datatype
VT_I2
Data type code.
3
offset
VT_I2
Offset of field from start of record.
4
size
VT_I2
Size of field.
5
decimal
VT_I2
Number of fixed decimal places, or bit offset for BIT data type fields.
6
flags
VT_I2
Field flags. See the SQL Language Reference for a description of field flag settings (search for "X$Field" in the index).
7
comment
VT_BSTR
Field comments stored in COMMENT.DDF.

When setting field information, the variant array must contain a minimum amount of information for each field to be defined. Required information includes a field name which is unique within the definition of the table, a valid datatype, and a valid size for data types which support more than one field length.

Note that the comment column of this array will be populated only if the DDFGetFieldComments method is called prior to reading the FieldList property.

If RefreshLocations is set to True, reading FieldList will cause the VAccess to re-read the DDF files and get the field information stored in the DDF. Changing FieldList with RefreshLocations set to True will no longer cause all changes to be immediately written to the DDF Files themselves. You must now call DdfAddTable, DdfModifyLocation, etc. to actually write the changes to the DDFs. This is a change in behavior since the release of the Pervasive.SQL 2000 SDK. If RefreshLocations is False, FieldList operations will read and update the VAccess control's memory image of the fields.

If DdfTransactionMode and RefreshLocations are both set to True, all manipulations of FieldList will occur within a transaction.

Example

'getting fields 
Dim fields as Variant 
VAEngine.RefreshLocations = True 
VAEngine.DdfGetFieldComments = True 
VAEngine.TableName = tableName 
fields = VAEngine.FieldList 
VAEngine.RefreshLocations = False 
If Not IsEmpty(fields) 
  For i = 0 to Ubound(fields, 2) 
    'put field names in a list box 
    List.AddItem fields(1, i) 
  Next i 
End If 
'setting 
VAEngine.RefreshLocations = False 
VAEngine.FieldList = fields 
'write changes to DDF - do not need to reset 
RefreshLocations 
VAEngine.DdfAddTable(True) 

See Also

Affected by: DdfTransaction Mode, RefreshLocations


Chapter contents
Publication contents

Prev topic: ExtendedOps
Next topic: Fields