Script to get access versions

A

ASGMikeG

Hi,
Does anyone know if it is possible from a script to get the version of an
Access database (i.e. 97, 2000, 2003) ?

We want to do a scan of server directories and identify versions and last
used dates.

Regars
Michael
 
A

ASGMikeG

Hi,
Thanks - was already looking at this but its may be a little overkill for
our purposes.
Regards
Michael Green
 
M

Matthias Klaey

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
 
A

ASGMikeG

Hi,
thanks for the reply - but unfortunately I need something that will work
from windows scripting host - I tried ADO but it doesn't return the same
property.....
Regards
Michael
 

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