Version Property Example

This example uses the Version property to report on the Microsoft Jet database engine in memory, a Microsoft Jet database, and an ODBC connection.

Sub VersionX()

   Dim wrkJet As Workspace
   Dim dbsNorthwind As Database
   Dim wrkODBC As Workspace
   Dim conPubs As Connection

   ' Open Microsoft Jet Database object.
   Set wrkJet = CreateWorkspace("NewJetWorkspace", _
      "admin", "", dbUseJet)
   Set dbsNorthwind = wrkJet.OpenDatabase("Northwind.mdb")

   ' Create ODBCDirect Workspace object and open Connection
   ' objects.
   Set wrkODBC = CreateWorkspace("NewODBCWorkspace", _
      "admin", "", dbUseODBC)
   Set conPubs = wrkODBC.OpenConnection("Connection1", , , _
      "ODBC;DATABASE=pubs;UID=sa;PWD=;DSN=Publishers")

   ' Show three different uses for the Version property.
   Debug.Print "Version of DBEngine (Microsoft Jet " & _
      "in memory) = " & DBEngine.Version
   Debug.Print "Version of the Microsoft Jet engine " & _
      "with which " & dbsNorthwind.Name & _
      " was created = " & dbsNorthwind.Version
   Debug.Print "Version of ODBCDirect connection " & _
      "(using Database property) = " & _
      conPubs.Database.Version

   dbsNorthwind.Close
   conPubs.Close
   wrkJet.Close
   wrkODBC.Close

End Sub