Databases Reference
In-Depth Information
can be shortened to:
DBEngine!MyWorkspace
and the phrase:
DBEngine.Workspaces(0)
can be shortened to:
DBEngine(0)
Also, since the default collection for a Workspace object is Databases , the phrase:
DBEngine.Workspaces(0).Databases(0)
can be shortened to:
DBEngine(0)(0)
Table 14-3 shows the default collections in the DAO and Access object model.
Table 14-3. DAO and Access object default collections
Object
Default collection
DBEngine
Workspaces
Workspace
Databases
Database
TableDefs
T ableDef
Fields
Recordset
Fields
Q ueryDef
Parameters
Index
Fields
R elation
Fields
Container
Documents
U ser
Groups
Group
Users
F orms
Controls
Reports
Controls
The use of default collections can save space. However, it does very little for readability
(to say the least) and is probably best left to programmers with so much experience that
they hardly read the names anyway! To emphasize the point, each of the lines in Example
14-4 displays the RecordCount property of the BOOKS table. Note that the full name of
the database library file on my computer is d:\dbase\library.mdb .
Example 14-4. A default collections example
Sub exaDefaultCollections( )
Search WWH ::




Custom Search