Share via


DAO: Opening DAO Objects

OverviewHow Do IFAQSampleODBC Driver List

Opening a DAO object implies that there is an existing object to be placed in an open state. This is distinct from creating a new object. In the typical case, the object to open is an element of the appropriate DAO collection, housed in some other DAO object.

An Open call puts the object into an open state, ready to be used. After using an object, you should explicitly close it.

Topics include:

  • Open member functions

  • Meaning of the Open action for different DAO objects

Open Member Functions

The following MFC DAO objects have Open member functions:

Meaning of the Open Action for Different DAO Objects

The concept of "open" has somewhat different meanings for different MFC DAO objects, as shown in the table “Meaning of Open for DAO Objects,” below. Typically, the object is already an element of a DAO collection that belongs to some other object. For example, each database object has a TableDefs collection that contains all tabledef objects in the database. The one object for which Open has a radically different meaning is ; opening the object appends it to the Databases collection of a workspace object.

Meaning of Open for DAO Objects

Object Meaning
Database Opens an existing database ? usually a Microsoft Jet (.MDB) database.
Querydef Opens the specified existing querydef object in the QueryDefs collection of a database.
Recordset Runs the query defined by the recordset's SQL statement or by an associated querydef; or opens the specified tabledef via a table-type recordset.
Tabledef Opens the specified existing tabledef object in the TableDefs collection of a database.
Workspace Opens the default workspace unless you give the name of a workspace previously created with .

See Also   , , , , , , , , , , , , ,