6.5. The Databases Collection
Using DAO, you can have more than one database open in Access at any time. If you're using an Access .mdb, you already have one database open (called the current database). Using the Workspace object's OpenDatabase method, as shown in the example in section on Using Transactions, you can open more than one database, and operate on them under the same workspace context. Indeed, if you were to define more than one Workspace object, you could have several databases open, each operating under a different workspace context. The choice is yours. The Databases collection contains and manages these databases.
6.5.1.
6.5.1.1. The Default (Jet) Database
Unless you're working with an Access Data Project, when Access starts, it creates a default Microsoft Jet database for you to work with. This default database is automatically added to the Databases collection.
Among its properties and methods, the Database object contains five collections: TableDefs, Containers, QueryDefs, Recordsets, and Relations. Each of these collections and their respective objects and properties are discussed in later sections. In most cases, you will be working with the default Microsoft Jet database, which you can refer to using any of the following syntaxes:
DBEngine.Workspaces("#Default Workspace#").Databases(0) DBEngine.Workspaces(0).Databases(0) DBEngine(0).Databases(0) DBEngine(0)(0) CurrentDb()
The current user's default database is an object that you will use quite a lot. ...
Get Access 2003 VBA Programmer's Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.