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. Although you can work with it using any of the reference methods listed above, in most cases it is often more convenient to assign it to an object variable.

Dim dbs As Database Set dbs = DBEngine(0)(0)

But far and away the most common method is to use the CurrentDb() function, described below.

Was this article helpful?

0 0

Post a comment