6.6. The Connections Collection

As you saw in the section entitled Opening and External Database, you can open an ODBCDirect database using the OpenDatabase method against an ODBCDirect workspace object. Similarly, you can also open an ODBCDirect connection using the OpenConnection method of the ODBCDirect workspace.

When you open an ODBCDirect Connection object, it is automatically added to the Connections collection, and a corresponding Database object is added to the ODBCDirect workspace's Databases collection. When you close the Connection object, both the Connection and Database objects are removed from their respective collections. You can refer to a Connection object as:

DBEngine(0).Connections( "Connection name" )
DBEngine(0).Connections(0)

Once a connection is established, you can open Recordsets, create QueryDefs and TableDefs, and just about anything else you can do using a Jet workspace.

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.