Microsoft Access - DBEngine(0)(0) - Asked By Vijay Raval on 02-May-11 09:59 AM

Can anyone tell me what the following means?

I like to understand things, not just copy it.

DBEngine(0)(0)

Thks

Vj
Riley K replied to Vijay Raval on 02-May-11 10:03 AM

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
Jitendra Faye replied to Vijay Raval on 02-May-11 10:05 AM
The DBEngine(0)(0) is the archaic equivalent of "CurrentDb" for Ms. Access.

DBEngine(0)(0) refers to the open copy of the database,
so setting two database variables will point to
the same instance of the open database.
Vijay Raval replied to Jitendra Faye on 03-May-11 02:32 PM
Hello, many thanks for all the help, is their any thing that I can read that will help me understand more.

I have to honest I am lost slightly on this topic.

Thanks you
Jitendra Faye replied to Vijay Raval on 04-May-11 01:51 AM