>
DBEngine Object
Description
The DBEngine object
represents the Microsoft Jet database engine. As the top-level
object, it contains and controls all other objects in the
hierarchy of data access objects.
Remarks
Use the DBEngine object
to control the Jet database engine, manipulate its properties,
and perform tasks on temporary objects that aren't elements of
collections. For example, you can:
-
Use the Version property to
obtain the version number of the Jet engine, the LoginTimeout
property to obtain or set the ODBC login timeout, and the
RegisterDatabase method to provide ODBC
information to the Jet engine.
-
Use the Idle method to enable
the Jet engine to complete any pending tasks and the CompactDatabase
and RepairDatabase methods to maintain database
files.
-
Use the CreateWorkspace
method to create a new session.
-
Use the Errors collection to
examine data access error details.
The DBEngine object is a
predefined object; you can't create additional DBEngine
objects. 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]
The DBEngine object
isn't an element of any collection.
Properties
DefaultUser, DefaultPassword
Properties; IniPath Property; LoginTimeout
Property; Version Property.
Methods
CompactDatabase Method,
CreateWorkspace Method, Idle Method,
RegisterDatabase Method, RepairDatabase Method.
See Also
Appendix, "Data Access
Object Hierarchy."
Specifics (Microsoft
Access)
Microsoft Access provides a
means of manipulating data access objects from other applications
through OLE Automation. If you are controlling Microsoft Access
from another application, such as Visual Basic or Microsoft
Excel, you can use the DBEngine property of the Microsoft
Access Application object to return a reference to the DBEngine
object. All data access objects and collections are then
accessible through the DBEngine object.
Example
This example enumerates the
collections of the DBEngine object. See the methods and
properties of DBEngine for additional examples.
Function EnumerateDBEngine () As Integer
Dim wrkEnum As Workspace, intWSP As Integer
Debug.Print "Enumeration of DBEngine"
Debug.Print
' Enumerate all workspaces.
Debug.Print "Workspaces: Name, UserName"
For intWSP = 0 To Workspaces.Count - 1
Set wrkEnum = Workspaces(intWSP)
Debug.Print " "; wrkEnum.Name;
Debug.Print ", "; wrkEnum.UserName
Next intWSP
Debug.Print
' Enumerate built-in properties.
Debug.Print "DBEngine.Version: "; DBEngine.Version
Debug.Print "DBEngine.LoginTimeout: "; DBEngine.LoginTimeout
EnumerateDBEngine = True
End Function
Example (Microsoft
Access)
The following example prints
all the properties of the DBEngine object.
Sub EngineProperties()
Dim prp As Property
For Each prp In DBEngine.Properties
Debug.Print prp.Name
Next prp
End Sub