Databases Collection

             

A Databases collection contains all open Database objects opened or created in a Workspace object.

objworks

parchildcoldatab

spaceparchildobjdatab

spacespaceparmultcoltable

spacespaceparmultcolconta

spacespaceparmultcolquery

spacespaceparmultcolrecor

spacespaceparchildcolrelat

Remarks

When you open an existing Database object or create a new one from a Workspace, it is automatically appended to the Databases collection. When you close a Database object with the Close method, it is removed from the Databases collection but not deleted from disk. You should close all open Recordset objects before closing a Database object.

In a Microsoft Jet workspace, the Name property setting of a database is a string that specifies the path of the database file. In an ODBCDirect workspace, the Name property is the name of the corresponding Connection object.

To refer to a Database object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:

Databases(0)

Databases("name")

Databases![name]

Note You can open the same data source or database more than once, creating duplicate names in the Databases collection. You should assign Database objects to object variables and refer to them by variable name.