You use data access objects the same way you use objects in the Microsoft Excel object model. For example, to change a field attribute in a specific table in your application, you first need to establish a reference to the field. Beginning at the application level (using the DBEngine object), you define a workspace and then enter the database. From there, you navigate through the object and collection levels until you reach the object you want to change.
The DBEngine object represents the Microsoft Jet database "engine," which is what powers Microsoft Access; this is the engine that Visual Basic uses to program database objects. This engine is actually a set of dynamic-link libraries (DLLs) that are linked to your application at run time. This engine is commonly referred to as "Jet," and it's the top-level object in the DAO model. It's this set of DLL files that translates the DAO code you write in your application into physical operations involving the Access .mdb file (or other database files). Also built into the DBEngine is a query processor that compiles and runs the Structured Query Language (SQL) queries you write to the database.
Note
The data file is the file that contains the database tables. Microsoft Access data files have the extension .mdb. Microsoft FoxPro® and dBASE® databases have the .dbf extension. Other database applications have different filename extensions.
The Workspace object represents a workspace, which is an area in memory where you can perform a set of DAO operations. It's similar to a Microsoft Excel worksheet in that more than one workspace can be open at a time, but only one workspace can be active at a time. Depending on your system configuration, you may be able to open as many as 255 workspaces at once. Because Workspace objects are zero-based, the first workspace you open is Workspace(0).
You can define a workspace variable and open any workspace you specify. Most applications use only one workspace; therefore, it's faster to use the default workspace that's automatically assigned when you open a database.
Note
It's possible to open a database without defining a workspace variable or using a Workspace object. To do this, define a database variable only; the variable will be assigned a default workspace when it's opened.
The Database object represents a Jet database, which is a collection of tables, indexes, fields, and links to outside sources. Whereas in Microsoft Excel you can define and set a range of cells as a database, in a Jet database the range you defined would be a single table. A Jet database is composed of a collection of tables (among other things).
The TableDefs collection object represents the collection of all the tables in a database. Each TableDef object represents a separate base table or attached table in the database.
The QueryDefs collection object represents all the compiled SQL code in the database. Each QueryDef object represents one compiled SQL command string.
A Recordset object represents a set of records drawn from the database. The records can be drawn from a base table, or they can be the result of a single SQL query or a series of queries. The records that make up a Recordset object don't have to be stored in the same table. The Recordset object has three subtypes: the Table object, the Dynaset object, and the Snapshot object.
The Table object represents a base table, which is a logical set of records that are physically stored together. For example, a set of employee records can be stored in the same table because all the employees work for same company. The records can then be subdivided, or grouped with other records from other tables; in the base table, however, they're still a logical, physical set of records.
The Dynaset object represents an updatable group of records. The group can be either a base table or a virtual table. A Dynaset object is updatable because the table indexes are loaded into memory, and the other fields in the record are retrieved from a buffer when they're needed.
Like a Dynaset object, a Snapshot object can represent either a base table or a virtual table. Unlike a Dynaset object, a Snapshot object isn't updatable; all fields in a Snapshot object record are loaded into memory so that the set can be searched faster for matching records. The result of a SQL pass-through query is always a Snapshot object.