Link to home
Start Free TrialLog in
Avatar of sebdieu
sebdieu

asked on

How to Check What Version of Access MDB file before openning the file ?

Say, U are running Access 2002 and the code is trying to open a second MDB in Access 2000, 97 or 2 versions.

Is there a function that can return what version that it is openning ?

Any suggestion ?

Sebastian Dieu
ASKER CERTIFIED SOLUTION
Avatar of mcallarse
mcallarse
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Take Two...

Public Function GetVersion(DbName)

Dim db As Object
Dim strVersion As Integer: strVersion = -1

On Error Resume Next

Set db = DBEngine.OpenDatabase(DbName)
With db
    Select Case Int(Left(.Properties("AccessVersion"), 2))
    Case 2: strVersion = 2
    Case 6: strVersion = 7
    Case 7: strVersion = 8
    Case 8
        If .Properties("RowLimit") Is Nothing Then
            strVersion = 9
        Else
            strVersion = 10
        End If
    Case 9: strVersion = 10
    Case Else: strVersion = 0
    End Select
 .Close
End With
Set db = Nothing

GetVersion = strVersion

End Function
Hi sebdieu,
This question has been abandoned and needs to be finalized (105 days since last comment).

   You can accept an answer, split the points, or get a refund. Go to
   http://www.cityofangels.com/Experts/Closing.htm for information and options.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

nexusnation
EE Cleanup Volunteer for Microsoft Access
Avatar of 1William
1William

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept question, points to mcallarse
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

1William
EE Cleanup Volunteer