Append Method

See Also      Applies To

Adds a new DAO object to a collection.

Syntax

VOIDcollection.Append( class& object );

The Append method syntax has these parts.

Part Description
collection An object variable that represents any collection that can accept new objects (for limitations, see the table at the end of this topic).
class& Reference to an object variable to be appended, which must be of the same class as the elements of collection.

Remarks

You can use the Append method to add a new table to a database, add a field to a table, and add a field to an index.

The appended object becomes a persistent object, stored on disk, until you delete it by using the Delete method. If collection is a CdbWorkspaces collection (which is stored only in memory), the object is active until you remove it by using the Close method.

The addition of a new object occurs immediately, but you should use the Refresh method on any other collections that may be affected by changes to the database structure.

If the object you are appending isn’t complete (such as when you haven’t appended any CdbField objects to a Fields collection of an CdbIndex object before it’s appended to an Indexes collection) or if the properties set in one or more subordinate objects are incorrect, using the Append method causes an error. For example, if you haven’t specified a field type and then try to append the CdbField object to the Fields collection in a CdbTableDef object, using the Append method triggers a run-time error.

The following table lists some limitations of the Append method. The object in the first column is an object containing the collection in the second column. The third column indicates whether you can append an object to that collection (for example, you can never append a CdbContainer object to the Containers collection of a CdbDatabase object).

Object Collection Can you append new objects?
CdbDBEngine Workspaces Yes
CdbDBEngine Errors No. New Error objects are automatically appended when they occur.
CdbWorkspace Connections No. Using the OpenConnection method automatically appends new objects.
CdbWorkspace Databases No. Using the OpenDatabase method automatically appends new objects.
CdbWorkspace Groups Yes
CdbWorkspace Users Yes
CdbConnection QueryDefs No. Using the CreateQueryDef method automatically appends new objects.
CdbConnection Recordsets No. Using the OpenRecordset method automatically appends new objects.
CdbDatabase Containers No
CdbDatabase QueryDefs Only when the CdbQueryDef object is a new, unappended object created with no name. See the CreateQueryDef method for details.
CdbDatabase Recordsets No. Using the OpenRecordset method automatically appends new objects.
CdbDatabase Relations Yes
CdbDatabase TableDefs Yes
CdbGroup Users Yes
CdbUser Groups Yes
CdbContainer Documents No
CdbQueryDef Fields No
CdbQueryDef Parameters No
CdbRecordset Fields No
CdbRelation Fields Yes
CdbTableDef Fields Only when the Updatable property of the CdbTableDef object is set to True, or when the CdbTableDef object is unappended.
CdbTableDef Indexes Only when the Updatable property of the CdbTableDef is set to True, or when the CdbTableDef object is unappended.
CdbIndex Fields Only when the CdbIndex object is a new, unappended object.
CdbDatabase, CdbField, CdbIndex, CdbQueryDef, CdbTableDef Properties Only when the CdbDatabase, CdbField, CdbIndex, CdbQueryDef, or CdbTableDef object is in a Microsoft Jet workspace.
CdbDBEngine, CdbParameter, CdbRecordset, CdbWorkspace Properties No