Access MDB Version

B

Bob Flenniken

When I use this code:

Set db = CurrentDB()
strProgramVersion = db.Properties("AccessVersion")
msgbox strProgramVersion

I get

07.53 for an Access 97 mdb file (version 8)
08.50 for an Access 2000 mdb file (version 9)
09.50 for an Access 2002 mdb file (version 10)

How do these mdb file Access Versions relate to the
version of Access in which they were created? It looks
like 1 less than the integer value of the first two
characters. Is this a rule I can count on???
 
C

Cheryl Fischer

I haven't tried the Database Properties to get the current version of
Access. I think the following might be easier:

Dim strVersion As String
strVersion = SysCmd(acSysCmdAccessVer)

hth,
 
B

Bob Flenniken

That will give me the version of Access that is running,
but I'm looking to understand the versioning of the mdb
file itself for use with automation. I may be running an
app in Access 2000 but when I use automation to open
another mdb file, I want to be able to know what version
of Access it was created in. So, the original question
still stands.
 
D

david epsom dot com dot au

characters. Is this a rule I can count on???
No. I found this on the web:
(http://www.ruriplus.com/msaccess/tch/tch_041.html)

There was more, but I didn't understand it.

(david)


Function GetCreatedVersion(argmdbFileName As String) As Integer
Dim db As Database
Dim strdir As String
Dim prp As Property
Dim blnFound As Boolean

strdir = Dir(argmdbFileName)
If Len(strdir) = 0 Then Exit Function
On Error GoTo GetCreatedVersion_err
Set db = DBEngine(0).OpenDatabase(argmdbFileName)

Select Case Left(db.Properties("AccessVersion"), 2)
Case "02"
GetCreatedVersion = 2
Case "06"
GetCreatedVersion = 7
Case "07"
GetCreatedVersion = 8
Case "08"
For Each prp In db.Properties
If prp.Name = "Row Limit" Then
blnFound = True
Exit For
End If
Next
GetCreatedVersion = IIf(blnFound = True, 10, 9)
Case "09"
GetCreatedVersion = 10
Case Else
GetCreatedVersion = 0
End Select
db.Close
Set db = Nothing
Exit Function

GetCreatedVersion_err:
Select Case Err.Number
Case 3045
MsgBox Err.Description
GetCreatedVersion = 0
Case 3343
Dim fno As Integer
Dim strKeyWord As String
fno = FreeFile
Open argmdbFileName For Input Access Read As fno
If LOF(fno) < 20 Then
GetCreatedVersion = 0
Else
Seek fno, 5
strKeyWord = Input(15, fno)
If strKeyWord = "Standard Jet DB" Then
GetCreatedVersion = -1
Else
GetCreatedVersion = 0
End If
End If
Close fno
Case Else
GetCreatedVersion = 0
End Select

If Not db Is Nothing Then
db.Close
Set db = Nothing
End If
Exit Function

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top