The
DBEngine object is the top level object in the DAO object model.
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:
- Use the Version property to obtain the DAO version number.
- Use the LoginTimeout property to obtain or set the ODBC login timeout, and the RegisterDatabase method to provide ODBC information to the Microsoft Access database engine.
- Use the DefaultPassword and DefaultUser properties to set the user identification and password for the default Workspace object.
- Use the CreateWorkspace method to create a new Workspace object. You can use optional arguments to override the settings of the DefaultType, DefaultPassword, and DefaultUser properties.
- Use the OpenDatabase method to open a database in the default Workspace, and use the BeginTrans, Commit, and Rollback methods to control transactions on the default Workspace.
- Use the Workspaces collection to reference specific Workspace objects.
- Use the Errors collection to examine data access error details.
The following example displays the DBEngine properties in a message box.
|
Private Sub Command1_Click()
DisplayApplicationInfo Me
End Sub
Function DisplayApplicationInfo(obj As Object) As Integer
Dim objApp As Object, intI As Integer, strProps As String
On Error Resume Next
' Form Application property.
Set objApp = obj.Application
MsgBox "Application Visible property = " & objApp.Visible
If objApp.UserControl = True Then
For intI = 0 To objApp.DBEngine.Properties.Count - 1
strProps = strProps & objApp.DBEngine.Properties(intI).Name & ", "
Next intI
End If
MsgBox Left(strProps, Len(strProps) - 2) & ".", vbOK, "DBEngine Properties"
End Function
|