• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 411
  • Last Modified:

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
0
sebdieu
Asked:
sebdieu
  • 2
1 Solution
 
mcallarseCommented:
How are you trying to open the second database? Following should work.

Function GetVersion(DbName)

Dim db As Object
Dim strVersion As String

On Error Resume Next

Set db = DBEngine.OpenDatabase(DbName)
With db
  strVersion =  .Properties("AccessVersion")
  .Close
End With
Set db = Nothing

If Not Err.Number=0 Then
  Err.Clear
  strVersion=-1
End If

GetVersion = strVersion

End Function
0
 
mcallarseCommented:
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
0
 
nexusnationCommented:
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
0
 
1WilliamCommented:
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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now