Field Object

See AlsovbobjFieldObjectSee              PropertiesvbobjFieldObjectProp           MethodsvbobjFieldObjectMth


A part of a recordset22S7WAF that defines one column of data.  The Value property of a Field object contains data from a single element of that column from the current record1BNJB8X.


Field objects are stored with a TableDef in a Database, and like a Table, a Field has a name that is recognized by the Database.  The default collection of a recordset22S7WAF is the Fields collection.  You can simplify your code by taking advantage of defaults.  For example, both of the following code lines print the value of the "PubID" Field in the current record1BNJB8X of a data control:

Print Data1.Recordset.Fields("PubID").Value
Print Data1.Recordset("PubID")


The Name property of a Field object is not the same as the name of an object variableZ3R9Q5 to which it is assigned.  Unlike forms and controls, the Name property of data access objects is available at run time.

Professional Edition

In the Professional Edition, you can declare an object variable as type Fields (a collection), or as a type Field.  You could use this code to print out the value of the "PubID" Field for each record in a Dynaset:

Dim MyDb As Database, MyDn As Dynaset, MyFd As Field
Set MyDb = OpenDatabase("BIBLIO.MDB")
Set MyDn = MyDb.CreateDynaset("Publishers")
Set MyFd = MyDb("PubID")
Do While Not MyDn.EOF
  Print MyFd