Version Property
Applies To
Database object, DBEngine object.
Description
- Microsoft Jet workspace — On the DBEngine object, returns the version of DAO currently in use. On the Database object, returns the version of Jet that created the .mdb file.
- ODBCDirect workspace — On the DBEngine object, returns the version of DAO currently in use. On the Database object, returns the version of the ODBC driver currently in use.
Return Values
The return value is a String that evaluates to a version number, formatted as follows:
- Microsoft Jet workspace — represents the version number in the form "major.minor". For example, "3.0". The product version number consists of the version number (3), a period, and the release number (0).
- ODBCDirect workspace — represents the DAO version number in the form "major.minor", or represents the ODBC driver version number in the form "major.minor.build". For example, the DBEngine.Version value of "3.5" indicated DAO version 3.5. A Database object's Version value of 2.50.1032 indicates that the current instance of DAO is connected to ODBC version 2.5, build 1032.
Remarks
In a Microsoft Jet workspace, the Version property of a Database object corresponds to a version of the Microsoft Jet database engine, and doesn't necessarily match the version number of the Microsoft product with which the database engine was included. For example, the Version property of a Database object created with Microsoft Visual Basic 3.0 will be 1.1, not 3.0.
The following table shows which version of the database engine was included with various versions of Microsoft products.
Microsoft Jet Version (year released) | Microsoft Access | Microsoft Visual Basic |
Microsoft Excel | Microsoft Visual C++ |
|
1.0 (1992) | 1.0 | N/A | N/A | N/A |
1.1 (1993) | 1.1 | 3.0 | N/A | N/A |
2.0 (1994) | 2.0 | N/A | N/A | N/A |
2.5 (1995) | N/A | 4.0 (16-bit) | N/A | N/A |
3.0 (1995) | 95 (7.0) | 4.0 (32-bit) | 95 (7.0) | 4.x |
3.5 (1996) | 97 (8.0) | 5.0 | 97 (8.0) | 5.0 |
See Also
CreateDatabase method.
Specifics (Microsoft Access)
Databases created in Microsoft Access 97 and Microsoft Access 95 have the same file format. Therefore, the Version property of a Database object returns 3.0 for databases created in or converted to either Microsoft Access 97 or Microsoft Access 95. If you need to distinguish between databases in Microsoft Access 97 format and databases in Microsoft Access 95 format, use the SysCmd function with the intrinsic constant acSysCmdAccessVer as the action argument to determine which version of Microsoft Access created the database. For a Microsoft Access 97 database, the SysCmd function will return 8.0. For a Microsoft Access 95 database, it will return 7.0.
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