Access Database Version

  • Thread starter Thread starter shaggie
  • Start date Start date
S

shaggie

Does anyone know how to read the version of Access that a database was
created for.

Basically I would like to manipulate the database in Access through code in
a VB executable.

I can get the Jet version of a database, but that does not allow me to tell
the difference between Access 2000 & Access XP.


I am looking for something where I never have to tell it what version the
database because it can figure it out.
Any help would be appreciated.

Mark
 
U¿ytkownik "shaggie said:
Does anyone know how to read the version of Access that a database was
created for.

Basically I would like to manipulate the database in Access through code in
a VB executable.

I can get the Jet version of a database, but that does not allow me to tell
the difference between Access 2000 & Access XP.


I am looking for something where I never have to tell it what version the
database because it can figure it out.
Any help would be appreciated.

Mark
 
I do not understand the replies of "hungjinwu" and " Bartek Janicki"
Were those replies in error, or are they in another language?

Mark
 
I was given this info by a MS rep.

***Quote:
We can use DAO's AccessVersion Property to get the file version information.
I developed a sample function for your reference. Please add reference to
Microsoft DAO 3.6 Object Library.
Note: Access 2000, Access 2002 both are Jet 4.x database file.

Function FindVersion(strDbPath As String) As String
Dim dbs As Database
Dim strVersion As String
Const conPropertyNotFound As Integer = 3270

On Error GoTo Err_FindVersion

' Open the database and return a reference to it.
Set dbs = OpenDatabase(strDbPath)

' Check the value of the AccessVersion property.
strVersion = dbs.Properties("AccessVersion")

Debug.Print strVersion


' Return the two leftmost digits of the value of
' the AccessVersion property.
strVersion = Left(strVersion, 2)

' Based on the value of the AccessVersion property,
' return a string indicating the version of Microsoft Access
' used to create or open the database.
Select Case strVersion
Case "02"
FindVersion = "2.0"
Case "06"
FindVersion = "95"
Case "07"
FindVersion = "97"
Case "08"
FindVersion = "2000"
Case "09"
FindVersion = "2002"
End Select

Exit_FindVersion:
On Error Resume Next
dbs.Close
Set dbs = Nothing
Exit Function

Err_FindVersion:
If Err.Number = conPropertyNotFound Then
MsgBox "This database hasn't previously been opened " & _
"with Microsoft Access."
Else
MsgBox "Error: " & Err & vbCrLf & Err.Description
End If
Resume Exit_FindVersion
End Function
 
Back
Top