DAO Object
 
The DBEngine object is the top level object in the DAO object model.
 

Remarks

The DBEngine object contains and controls all other objects in the hierarchy of DAO objects. You can't create additional DBEngine objects, and the DBEngine object isn't an element of any collection.
With any type of database or connection, you can:
 
Other properties and methods are only available when you use DAO with the Microsoft Access database engine. You can use them to control the Microsoft Access database engine, manipulate its properties, and perform tasks on temporary objects that aren't elements of collections. For example, you can:
 
After you change the DefaultType and IniPath property settings, only subsequent Workspace objects will reflect these changes.
 
To refer to a collection that belongs to the DBEngine object, or to refer to a method or property that applies to this object, use this syntax:
[DBEngine.][collection | method | property]
 

Methods

Name
Description

Begins a new transaction. Read/write Database.

Ends the current transaction and saves the changes.

Copies and compacts a closed database, and gives you the option of changing its version, collating order, and encryption. (Microsoft Access workspaces only). .

Creates a new Database object, saves the database to disk, and returns an opened Database object (Microsoft Access workspaces only). .

Creates a new Workspace object.

Suspends data processing, enabling the Microsoft Access database engine to complete any pending tasks, such as memory optimization or page timeouts (Microsoft Access workspaces only).

One of the WorkspaceTypeEnum values.
NOTE: ODBCDirect workspaces are not supported in Microsoft Access 2013. Use ADO if you want to access external data sources without using the Microsoft Access database engine.
Opens a Connection object on an ODBC data source (ODBCDirect workspaces only).
Opens a specified database and returns a reference to the Database object that represents it.

Enters connection information for an ODBC data source in the Windows Registry. The ODBC driver needs connection information when the ODBC data source is opened during a session.

Ends the current transaction and restores the databases in the Workspace object to the state they were in when the current transaction began.

Temporarily overrides values for the Microsoft Access database engine keys in the Windows Registry (Microsoft Access workspaces only).

 

Properties

Name
Description
Sets the password used to create the default Workspace when it is initialized. Read/write String.
Sets or returns a value that indicates what type of workspace will be used by the next Workspace object created.
Sets the user name used to create the default Workspace when it is initialized. Read/write String.
Returns an Errors collection that contains all of the stored Error objects for the specified object. Read-only.
Sets or returns information about the Windows Registry key that contains values for the Microsoft Access database engine (Microsoft Access workspaces only).
Sets or returns the number of seconds before an error occurs when you attempt to log on to an ODBC database.
Returns the Properties collection of the specified object. Read-only.
Rreturns the version of DAO currently in use. Read-only String.
Returns a Workspaces collection that contains all of the active, unhidden Workspace objects. Read-only.
 

Example

This example enumerates the collections of the DBEngine object.
 
Sub DBEngineX()
    
     Dim wrkLoop As Workspace
     Dim prpLoop As Property
    
     With DBEngine
     Debug.Print "DBEngine Properties"
    
     ' Enumerate Properties collection of DBEngine,
     ' trapping for properties whose values are
     ' invalid in this context.
     For Each prpLoop In .Properties
     On Error Resume Next
     Debug.Print " " & prpLoop.Name & " = " _
     & prpLoop
     On Error GoTo 0
     Next prpLoop
    
     Debug.Print "Workspaces collection of DBEngine"
    
     ' Enumerate Workspaces collection of DBEngine.
     For Each wrkLoop In .Workspaces
     Debug.Print " " & wrkLoop.Name
    
     ' Enumerate Properties collection of each
     ' Workspace object, trapping for properties
     ' whose values are invalid in this context.
     For Each prpLoop In wrkLoop.Properties
     On Error Resume Next
     Debug.Print " " & prpLoop.Name & _
     " = " & prpLoop
     On Error GoTo 0
     Next prpLoop
    
     Next wrkLoop
    
     End With
    
    End Sub