ADODB Object
 
The Fields Collection is a collection of all of the Field objects associated with a specific Record object.
The Fields Collection has a wider selection of methods than the various other collections in ADO. For example, the Append method allows you to add Field objects to the collection and the Update and CancelUpdate methods give you control over updates.
 
If you reference by name a Field object that does not exist, a new Field object with that name will be appended automatically to the Fields Collection. The Status property for this newly appended Field will be assigned a FieldStatusEnum value of adFieldPendingInsert. Further, if allowed by your provider, the Field will be created in the data source the next time you call the Update method.
 
There are two special fields which can be referenced in a Record object by using the FieldEnum constants:
 
Constant
Value
Description
adDefaultStream
-1
References the field containing the default stream
adRecordURL
-2
References the field containing the absolute URL
 
A Recordset object can also have a Fields Collection.
 
The Fields Collection has two properties and six methods.
 

Properties

The Count property returns a long value that is the number of items in the collection. The counting starts at zero. You can use this value to loop through the collection by iterating from zero to the value of Count minus one.
The Item property is used to return a specific member of the Fields Collection.
 

Methods

The Append method is used to add (append) a Field object to the Fields Collection.
The CancelUpdate method cancels all pending deletions, insertions, or updates to the Fields Collection for a specific Record object.
The Delete method designates that a specified Field object is to be deleted from the Fields Collection.
Although, the Refresh method is used to update objects in a collection, this method has no effect on the Fields Collection of the Record object.
The Resync method is used to refetch the data from the underlying data source and to update (resynchronize) the values in the OriginalValue, UnderlyingValue, and Value properties of Field objects that are in the Fields Collection object of a Record object, or just to update the UnderlyingValue property.
The Update method is called to make additions, deletions, and updates to the Fields Collection of the Record object.