Fields Collection

See AlsovbobjFieldsCollectionSee              PropertiesvbobjFieldsCollectionProp           MethodsvbobjFieldsCollectionMth

Description

A collection of Field objects.  A Fields collection can be found in all recordset objects (Table, Dynaset, Snapshot), and in a TableDef object.

Remarks

The default collection of a recordset is the Fields collection, and the default property of a Field is the Value property.  You can simplify your code by taking advantage of these defaults.  For example, using the defaults, the following statements are identical:

Data1.Recordset.Fields("PubID").Value = 99
Data1.Recordset("PubID") = 99

 

Like a Table, a Field has a name that is recognized by the Database.  The Name property of a Field is not the same as the name of an object variable to which it is assigned.  Unlike forms and controls, the Name property of a Field object is available at run time.

You can access the individual members of a collection one of two ways:

         By number (ordinal position) as you would with the Forms collection or the Controls collection of a Form object:
Fields(0)

         By name, which is unique to data access objects:
Fields("PubID")

 

The Fields collection is not the same as the Fields property of an Index object.

Professional Edition

In the Professional Edition, you can declare an object variableZ3R9Q5 as type Fields (a collection), or as type Field.