Field Object (Versions 2.0, 2.1, 2.5, 2.6)
Dim field As ADODB.Field

The Field object represents an individual column within a Recordset or a Record object's Fields collection. A Field contains metadata properties that define its datatype, size, and precision.

Field.ActualSize Property (Versions 2.0, 2.1, 2.5, 2.6)

actualsize = field.ActualSize
 

The ActualSize property returns the actual length of a field's value.

Datatype

Long

 
Description

The ActualSize property returns a number indicating how many bytes are stored in the specified field, as opposed to the maximum number of bytes allowed (indicated through the DefinedSize property). If the length of the Field object's value cannot be determined by ADO, adUnknown is returned.

 
See Also

Field.DefinedSize Property

 
Field.AppendChunk (Versions 2.0, 2.1, 2.5, 2.6)

field.AppendChunk Data
 

The AppendChunk method is used to append data to a large data or binary field.

Arguments
Data (Variant)

Contains the large amount of data that you wish to append to the current Field object.

 
Description

The AppendChunk method appends large amounts of either text or binary data to an existing Field object. This can come in very useful when the current system contains limited system memory with regard to the amount needed for the operation to be performed. With the AppendChunk method, you can add the data to your Field object in increments as you see fit.

You can use the AppendChunk method with a Field object only if the adFldLong bit of the Arguments property of that Field object is set to True.

By calling the AppendChunk method for the first time, you overwrite any data that may already be in that field. With each additional call to the AppendChunk method, the data is appended to the end of the pre-existing data. ADO assumes that you are finished appending to a particular field in a recordset if you then read or write data in another field in the same recordset. What this means is that if you call the AppendChunk method again on the original field, the data is once again cleared, as if it were the first call to the method. Reading or writing data in another Recordset object will not cause this action to occur, unless it is a clone of the original Recordset object.

 
See Also

Field.Attributes Property, FieldAttributeEnum Enumeration

 
Field.Attributes Property (Versions 2.0, 2.1, 2.5, 2.6)

field.Attributes = attributes
 

The Attributes property sets or returns specific characteristics about the Field object.

Datatype

Long

 
Description

The Attributes property is read-only; it can be a sum of the values from the FieldAttributesEnum enumeration listed in Appendix E indicating the characteristics of the Field object, such as whether it is updatable or represents a row identifier.

 
See Also

FieldAttributesEnum Enumeration

 
Field.DataFormat Property (Versions 2.0, 2.1, 2.5, 2.6)

 
 

The DataFormat property links the current Field object to a data-bound control.

Datatype

StdDataFormat

 
Description

The DataFormat property is both read- and write-enabled. It accepts and returns a StdDataFormat object that is used to attach a bound object.

The DataFormat property for the Field object is not documented at all in the ADO help files -- however, the DataFormat property is used in other Microsoft objects outside of ADO.

 
Field.DefinedSize Property (Versions 2.0, 2.1, 2.5, 2.6)

definedsize = field.DefinedSize
 

The DefinedSize property represents the size, in bytes, of the capacity of a Field object's datatype.

Datatype

Long

 
Description

The DefinedSize property is used to determine the data capacity of a Field object's Value property, in bytes. This property differs from the ActualSize property, which indicates how many bytes of the defined datatype size are actually being used.

 
See Also

Field.ActualSize Property

 
Field.GetChunk Method (Versions 2.0, 2.1, 2.5, 2.6)

Set value = field.GetChunk(NumBytes)
 

The GetChunk method returns the specified number of bytes or characters from the specified field.

Arguments
NumBytes

The NumBytes parameter is a Long value representing the number of bytes or characters that you want to receive.

 
Returns

Variant

 
Description

The GetChunk method gets pieces of information from a Field object that belongs to a Fields collection of an open Recordset object. If the Arguments property of the Field object is set to adFldLong, you can use the GetChunk method on that field.

The first call to GetChunk retrieves the number of bytes specified in the method call, from the beginning of the field. All subsequent calls to GetChunk will return data starting from where the last call to GetChunk left off. If the amount of bytes or characters in the Field object is fewer than the amount that you requested, only the remainder is returned without padding for the difference.

When you read or write to another field within the same Recordset object (one that is not a clone of that recordset), ADO assumes that you are done retrieving chunks from that particular Field object. The next call to GetChunk will perform as if it were the first, retrieving the first number of bytes or characters that you request.

 
See Also

Field.Arguments Property

 
Field.Name Property (Versions 2.0, 2.1, 2.5, 2.6)

Set value = field.GetChunk(NumBytes)
 

The Name property specifies the name for the current Field object.

Datatype

String

 
Description

The Name property retrieves a Field object from the Fields collection. Names do not have to be unique within collections.

 
Field.NumericScale Property (Versions 2.0, 2.1, 2.5, 2.6)

field.NumericScale = numericscale
 

The NumericScale property indicates the scale of numeric values in the current Field object.

Datatype

Byte

 
Description

The read-only NumericScale property identifies how many bytes are used to the right of the decimal point for a Field object containing a numeric value.

 
Field.OriginalValue Property (Versions 2.0, 2.1, 2.5, 2.6)

originalvalue = field.OriginalValue
 

The OriginalValue property returns the value that belonged to a field before any changes were made to it.

Datatype

Variant

 
Description

In Immediate mode, the OriginalValue property returns the value of a field in the current record before any changes were made to it. In other words, the OriginalValue property is the value of the field when the last Update method was called. This is the value that is replaced in the Field object when the CancelUpdate method is called.

In Batch Update mode, the OriginalValue property returns the value of a field in the current record before any changes were made to it. In other words, the OriginalValue property is the value of the field when the last UpdateBatch method was called. This is the value that is replaced in the Field object when the CancelBatch method is called.

 
See Also

Recordset.CancelBatch Method, Recordset.CancelUpdate Method, Recordset.Update Method, Recordset.UpdateBatch Method

 
Field.Precision Property (Versions 2.0, 2.1, 2.5, 2.6)

precision = field.Precision
 

The Precision property represents the degree of precision of a numeric value within the current Field object.

Datatype

Byte

 
Description

The Precision property is read-only for the Field object. This property returns a Byte value that indicates the total number of digits used to represent a value for a numeric Field object.

 
Field.Properties Collection (Versions 2.0, 2.1, 2.5, 2.6)

Set properties = field.Properties
 

The Properties collection contains characteristics specific to the Field object for the currently used provider.

Datatype

Properties (Collection object)

 
Description

The Properties collection class contains a Property class instance for each property specific to the Field object for the data provider.

 
Field.Status Property (Versions 2.5, 2.6)

status = field.Type
 

The Status property indicates the status of the current Field object.

Datatype

FieldStatusEnum

 
Description

The default value for the Status property is adFieldOK.

After a call to the Record or Recordset's Update method if an error has occurred the Status property of each Field object is set to a value from the FieldStatusEnum enumeration, describing the problem.

If you are adding and deleting Field objects to and from the Fields collection, the Status property can tell you whether they have been successfully added or deleted.

The Status property can hold more than one FieldStatusEnum enumeration value at a time.

 
See Also

FieldStatusEnum Enumeration, Record.Update Method, Recordset.Update Method

 
Field.Type Property (Versions 2.0, 2.1, 2.5, 2.6)

datatype = field.Type
 

The Type property indicates the datatype of the Field's Value property.

Datatype

DataTypeEnum

 
Description

The Type property is read-only unless it is for a new Field object that has been appended to the Fields collection of a Record object, of which it is only read/write after the Value property of the Field object has already been specified and the data provider has added the Field object to the data source (by using the Update method of the Fields collection).

 
See Also

DataTypeEnum Enumeration, Field.Value Property, Fields.Update Method

 
Field.UnderlyingValue Property (Versions 2.0, 2.1, 2.5, 2.6)

underlyingvalue = field.UnderlyingValue
 

The UnderlyingValue property returns the current value of the Field object's Value property.

Datatype

Variant

 
Description

The UnderlyingValue property returns the value -- from the current record -- of the associated Field object. This value may differ from the OriginalValue property as it shows the value of a field for the current transaction.

This is the same value that the Resync method uses to replace the value of the Value property.

 
See Also

Field.OriginalValue, Field.Value Property, Recordset.Resync Method

 
Field.Value Property (Versions 2.0, 2.1, 2.5, 2.6)

field.Value = value
 

The Value property indicates the value assigned to the current Field object.

Datatype

Variant

 
Description

The Value property is used to read and set the value of the associated Field object. The Value property supports long binary data through ADO.

 
Fields Collection (Versions 2.0, 2.1, 2.5, 2.6)

Set fields = record.Fields
Set fields = recordset.Fields
 

See the Field object for more information and examples pertaining to the Fields collection.

Applies To
Recordset

Offers a particular view of a group of records from the associated connection.

 
Objects
Field

Contains information about a single field in the current record of an open Recordset object.

 
Methods
Append

Adds a new Field object to the collection.

CancelUpdate

Cancels any pending changes to the individual Field objects of the Record object's Fields collection.

Delete

Removes a Field object from the current Fields collection.

Refresh

Does not perform any visible function according to the Microsoft documentation.

Resync

Updates the current collection based upon the underlying database.

Update

Persists any changes made to the current Fields collection of a Record object.

 
Properties
Count

Indicates how many Field objects belong to the associated Fields collection.

Item

Accesses a particular Field object belonging to the Fields collection.

 
Fields.Append Method (Versions 2.0, 2.1, 2.5, 2.6)

fields.Append Name, Type, DefinedSize, Attrib, FieldValue
 

The Append method adds a new Field object to the collection.

Arguments
Name (String)

Represents the name of the field to append to the Fields collection. This name must not already exist within the collection.

Type (DataTypeEnum)

Specifies the datatype of the Field's Value property. The default value for this parameter is adEmpty.

DefinedSize (String)

Optional. Dictates the length of the value stored within the Field object. The value of this parameter is derived from the Type property.

Attrib (FieldAttributeEnum)

Optional. Specifies additional information regarding the new Field object. The default value for this parameter is adFldDefault.

FieldValue (Variant)

Optional. Gives the new Field object a value. The default for this parameter is Null. This parameter is valid only when adding a Field object to a Record object's Fields collection, not a Recordset object's.

 
Description

The following datatypes are not supported by ADO and cannot be used when adding new Field objects to the collection class: adIDispatch, adIUnknown, and adVariant.

The following datatypes cannot be added to the Field's collection and will generate an error: adArray, adChapter, adEmpty, adPropVariant, and adUserDefined.

When using the Append method with a Fields collection of a Recordset object, you cannot use the FieldValue parameter. Instead, you must add the Field objects while the Recordset object is closed and then assign them values after it is opened.

When appending Field objects to the Fields collection of a Record object, you must first set the Field.Value property and call the Update method before accessing any other Field properties such as Type.

 
See Also

DataTypeEnum Enumeration, FieldAttributeEnum Enumeration

 
Fields.CancelUpdate Method (Versions 2.5, 2.6)

record.Fields.CancelUpdate
 

The CancelUpdate method cancels any pending changes to the individual Field objects of the Record object's Fields collection.

Description

After calling the CancelUpdate method, all of the Field Objects will have a status of adFieldOK.

 
See Also

Record Object

 
Fields.Count Property (Versions 2.0, 2.1, 2.5, 2.6)

count = fields.Count
 

The Count property indicates how many Field objects belong to the associated Fields collection.

Datatype

Long

 
Description

If the value of the Count property is zero, there are no Field objects within the associated Fields collection. However, Field objects that do belong to the associated Fields collection are indexed from 0 to one less than the value of the Count property.

 
Fields.Delete Method (Versions 2.0, 2.1, 2.5, 2.6)

Fields.Delete Field
 

The Delete method removes a Field object from the current Fields collection.

Arguments
Field

Either the name of a valid Field object within the current Field's collection or the ordinal position of a Field object within the collection to be removed.

 
Description

You can call the Field.Delete method only on a closed Recordset object.

 
Fields.Item Property (Versions 2.0, 2.1, 2.5, 2.6)

Set field = fields.Item(Index)
Set field = fields(Index)
 

The Item property accesses a particular Field object belonging to the Fields collection.

Datatype

Object

 
Description

The Index placeholder represents a Variant datatype that represents the ordinal position of a Field object within the Fields collection. If the Fields collection does not contain the item requested, an error is generated.

 
Note

Some languages do not support the Item property in its first syntax. For these languages, use the second syntax, without the Item method name.

 
Fields.Refresh Method (Versions 2.0, 2.1, 2.5, 2.6)

Fields.Refresh
 

The Refresh method does not perform any visible function according to the Microsoft documentation.

Description

In order to update the Fields collection with changes from the underlying database, use the Resync method or the MoveFirst method if the Recordset object doesn't support bookmarks.

 
See Also

Recordset.MoveFirst Method, Recordset.Resync Method

 
Fields.Resync Method (Versions 2.5, 2.6)

record.Fields.Resync ResyncValues
 

The Resync method updates the current collection based upon the underlying database.

Arguments
ResyncValues (ResyncEnum)

Optional. Specifies whether the underlying values within the Fields collection are overwritten. The default value for this parameter is adResyncAllValues.

 
Description

The Resync method resynchronizes the Field objects of a Record object's Fields collection with those within the underlying database.

The default value for the only parameter to this method, adResyncAllValues synchronizes all of the values within the UnderlyingValue, Value, and OriginalValue properties.

If a Field object within the collection has a Status property equal to either adFieldPendingUnknown or adFieldPendingInsert, then the Resync method is ignored for those Field objects.

 
See Also

Field.OriginalValue Property, Field.Status Property, Field.UnderlyingValue Property, Field.Value Property, ResyncEnum Enumeration

 
Fields.Update Method (Versions 2.5, 2.6)

record.Fields.Update
 
Description

The Update method persists any pending changes to the current Fields collection of a Record object.

Dim parameter As ADODB.Parameter