Connections Collection

             

A Connections collection contains the current Connection objects of a Workspace object. (ODBCDirect workspaces only).

objworks

parchildcolconn

spaceparchildobjconn

spacespaceparmultcolquery

spacespaceparchildcolrecor

Remarks

When you open a Connection object, it is automatically appended to the Connections collection of the Workspace. When you close a Connection object with the Close method, it is removed from the Connections collection. You should close all open Recordset objects within the Connection before closing it.

At the same time you open a Connection object, a corresponding Database object is created and appended to the Databases collection in the same Workspace, and vice versa. Similarly, when you close the Connection, the corresponding Database is deleted from the Databases collection, and so on.

The Name property setting of a Connection is a string that specifies the path of the database file. To refer to a Connection object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:

Connections(0)

Connections("name")

Connections![name]

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