Creating Database Objects

The first operation you are likely to perform using DAO involves data definition: creating objects, assigning characteristics to objects by using properties, and interrogating the structure of existing objects.

Creating a new object is a two-step process. First you create the object and define its characteristics, and then you append the object to its collection. The process of appending an object to a collection makes it a permanent or persistent part of the database. Additionally, if the object you’re creating contains child objects, you first create the parent object, then create and append the child object, and finally, append the parent object to its collection.

Note Unlike other DAO objects, Workspace objects can be created and then appended to the Workspaces collection, but they don’t become a permanent part of the database. When you exit the application, all Workspace objects are not saved. It’s important to remember that a Workspace object is only a “space” used to identify a specific user and transaction sequence. Recordset objects work in the same way.

Also, when you create a new Database object by using the CreateDatabase method, the new database automatically becomes a persistent object on the drive where it’s created. You don’t have to explicitly append it to the Databases collection to make it persistent.

You can also create linked tables, which are tables stored in files outside the current database. Because Microsoft Jet supports a variety of external data sources, you are not limited to linking to only Microsoft Jet databases.

See Also For more information, see Chapter 8, “Accessing External Data.”