Append Method
Adds a new DAO object to a collection.
Syntax
collection.Append 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). |
object | An object variable that represents the object being appended, which must be of the same type 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 Workspaces 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're appending isn't complete (such as when you haven't appended any Field objects to a Fields collection of an Index 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 Field object to the Fields collection in a TableDef 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 Container object to the Containers collection of a Database object).
Object | Collection | Can you append new objects? |
---|---|---|
DBEngine | Workspaces | Yes |
DBEngine | Errors | No. New Error objects are automatically appended when they occur. |
Workspace | Connections | No. Using the OpenConnection method automatically appends new objects. |
Workspace | Databases | No. Using the OpenDatabase method automatically appends new objects. |
Workspace | Groups | Yes |
Workspace | Users | Yes |
Connection | QueryDefs | No. Using the CreateQueryDef method automatically appends new objects. |
Connection | Recordsets | No. Using the OpenRecordset method automatically appends new objects. |
Database | Containers | No |
Database | QueryDefs | Only when the QueryDef object is a new, unappended object created with no name. See the CreateQueryDef method for details. |
Database | Recordsets | No. Using the OpenRecordset method automatically appends new objects. |
Database | Relations | Yes |
Database | TableDefs | Yes |
Group | Users | Yes |
User | Groups | Yes |
Container | Documents | No |
QueryDef | Fields | No |
QueryDef | Parameters | No |
Recordset | Fields | No |
Relation | Fields | Yes |
TableDef | Fields | Only when the Updatable property of the TableDef object is set to True, or when the TableDef object is unappended. |
TableDef | Indexes | Only when the Updatable property of the TableDef is set to True, or when the TableDef object is unappended. |
Index | Fields | Only when the Index object is a new, unappended object. |
Database, Field, Index, QueryDef, TableDef | Properties | Only when the Database, Field, Index, QueryDef, or TableDef object is in a Microsoft Jet workspace. |
DBEngine, Parameter, Recordset, Workspace | Properties | No |