Append Method (ADO)

See Also   Example   Applies To   

Appends an object to a collection. If the collection is Fields, a new Field object may be created before it is appended to the collection.

Syntax

collection.Append object

fields.Append Name, Type, DefinedSize, Attrib

Parameters

collection   A collection object.

fields   A Fields collection.

object   An object variable representing the object to be appended.

Name   A String. The name of the new Field object, which must not be the same name as any other object in fields.

Type   A DataTypeEnum, whose default value is adEmpty. The data type of the new field.

DefinedSize   Optional. A Long. The defined size in characters or bytes of the new field. The default value for this parameter is derived from Type. (The default Type is adEmpty, and default DefinedSize is unspecified.)

Attrib   Optional. A FieldAttributeEnum, whose default value is adFldDefault. Specifies attributes for the new field. If this value is not specified, the field will contain attributes derived from Type.

Parameter

Use the Append method on a collection to add an object to that collection. This method is available only on the Parameters collection of a Command object. You must set the Type property of a Parameter object before appending it to the Parameters collection. If you select a variable-length data type, you must also set the Size property to a value greater than zero.

By describing the parameter yourself, you can minimize calls to the provider and consequently improve performance when using stored procedures or parameterized queries. However, you must know the properties of the parameters associated with the stored procedure or parameterized query you want to call. Use the CreateParameter method to create Parameter objects with the appropriate property settings and use the Append method to add them to the Parameters collection. This lets you set and return parameter values without having to call the provider for the parameter information. If you are writing to a provider that does not supply parameter information, you must manually populate the Parameters collection using this method to be able to use parameters at all.

Fields

You must set the CursorLocation property to adUseClient before calling the fields.Append method.

Calling the fields.Append method for an open Recordset, or a Recordset where the ActiveConnection property has been set, will cause a run-time error.