ASGMikeG said:
Hi,
Thanks - was already looking at this but its may be a little overkill for
our purposes.
Regards
Michael Green
Below is a function that may be used from Access 2003 or from VB6 with
a reference to the DAO 3.6 library..
HTH
Matthias Kläy
Public Enum geAccessVersion
AccessXP2003
Access2000
Access97
Access95
Access2
Access11 ' Access 1.1
Access10 ' Access 1.0
AccessUnknownVersion
AccessUnknownJetVersion
AccessFileInUse
AccessLocked
AccessNoPersmission
AccessOtherError
End Enum
Public Function kMDBVersionFromFile(strTestDB As String) _
As geAccessVersion
Dim wrk As DAO.Workspace
Dim db As DAO.Database
On Error GoTo kErrLabel
Set wrk = CreateWorkspace("CheckVersion", "admin", _
vbNullString, dbUseJet)
On Error Resume Next
Set db = wrk.OpenDatabase(strTestDB, False, True)
If Err.Number = 0 Then
If db.Version >= "3.0" Then
Select Case db.Properties("AccessVersion")
Case "09.50"
kMDBVersionFromFile = geAccessVersion.AccessXP2003
Case "08.50"
kMDBVersionFromFile = geAccessVersion.Access2000
Case "07.53"
kMDBVersionFromFile = geAccessVersion.Access97
Case "06.68"
kMDBVersionFromFile = geAccessVersion.Access95
Case Else
kMDBVersionFromFile = _
geAccessVersion.AccessUnknownVersion
End Select
Else
Select Case db.Version
Case "2.0"
kMDBVersionFromFile = geAccessVersion.Access2
Case "1.1"
kMDBVersionFromFile = geAccessVersion.Access11
Case "1.0"
kMDBVersionFromFile = geAccessVersion.Access10
Case Else
kMDBVersionFromFile =
geAccessVersion.AccessUnknownJetVersion
End Select
End If
ElseIf Err.Number = 3045 Then
kMDBVersionFromFile = geAccessVersion.AccessFileInUse
ElseIf Err.Number = 3033 Then
kMDBVersionFromFile = geAccessVersion.AccessNoPersmission
ElseIf Err.Number = 3356 Then
kMDBVersionFromFile = geAccessVersion.AccessLocked
Else
kMDBVersionFromFile = geAccessVersion.AccessOtherError
End If
If Not db Is Nothing Then
db.Close
Set db = Nothing
End If
wrk.Close
Set wrk = Nothing
Exit Function
kErrLabel: Call MsgBox("Error " & Err.Number & ": " & Err.Description)
End Function