I have over 16, 000 files to check.
Add a module, and add a Reference to the latest version of DAO (ie DAO 3.6 at time of writing.) You can then use the following function:
Public Function GetVersion(pstrFilePath As String) As String
'----------------------------------------------
' Copyright 2002 Superior Software for Windows
'----------------------------------------------
' www.ssw.com.au All Rights Reserved.
' VERSION AUTHOR DATE COMMENT
' 1.0 DDK 17/10/2002 Determine Version of a file in a path.
' SAMPLE USAGE:
'----------------------------------------------
Dim dbs As DAO.Database
Dim strVersion As String
Const conPropertyNotFound As Integer = 3270
On Error GoTo Err_GetVersion
' Open the database and return a reference to it.
Set dbs = OpenDatabase(pstrFilePath)
' Check the value of the AccessVersion property.
strVersion = dbs.Properties("AccessVersion")
' Return the two leftmost digits of the value of
' the AccessVersion property.
strVersion = Left(strVersion, 2)
' Based on the value of the AccessVersion property,
' return a string indicating the version of Microsoft Access
' used to create or open the database.
Select Case strVersion
Case "02"
GetVersion = "2.0"
Case "06"
GetVersion = "7.0"
Case "07"
GetVersion = "8.0"
Case "08"
GetVersion = "9.0"
Case "09"
GetVersion = "10.0"
End Select
MsgBox "Access Database Version is " & GetVersion
Exit_GetVersion:
On Error Resume Next
dbs.Close
Set dbs = Nothing
Exit Function
Err_GetVersion:
If Err.Number = conPropertyNotFound Then
MsgBox "This database hasn't previously been opened " & _
"with Microsoft Access."
Else
MsgBox "Error: " & Err & vbCrLf & Err.Description
End If
Resume Exit_GetVersion
End Function
-------------------------------------------------------------------------------
Method 2
Recent machines usually have MS Scripting Runtime (Part of Windows), and not necessarily DAO, so this method may be suitable.
-------------------------------------------------------------------------------
You can also use the FileSystemObject from the scripting runtime to accomplish this.
Function GetVersion()
'Reference: Microsoft Scripting Runtime
Dim fso As FileSystemObject
Set fso = New FileSystemObject
Dim strAccess97 As String
strAccess97 = "C:\Program Files\Microsoft Office97\Office\MSACCESS.EXE"
MsgBox "strAccess97 - " & fso.GetFileVersion(strAccess97)
'Returns - strAccess97 - 8.0.0.5903
Dim strAccess2000 As String
strAccess2000 = "C:\Program Files\Microsoft Office 2000\Office\Msaccess.exe"
MsgBox "strAccess2000 - " & fso.GetFileVersion(strAccess2000)
'Returns - strAccess2000 - 9.0.0.3822
Dim strAccess2002 As String
strAccess2002 = "C:\Program Files\Microsoft Office XP\Office10\MSACCESS.EXE"
MsgBox "strAccess2002 - " & fso.GetFileVersion(strAccess2002)
'Returns - strAccess2002 - 10.0.2627.1
'###################################################
'The following is an easier method
' However it will only COMPILE and work in Access 2002
' Consequently that means it is pretty useless
MsgBox "Application.Version - " & Application.Version
'Returns in Access 2002 - Application.Version - 10.0
MsgBox "Application.Build - " & Application.Build
'Returns in Access 2000 - Application.Build - 2627
'###################################################
End Function