Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application.FileSearch 1

Status
Not open for further replies.

rgbanse

MIS
Jun 4, 2001
211
US
I'm using Application.FileSearch to find all mdb's stored on a series of hard drives. No problme here but also need to know what version of access each db is. We have 97 thru current.
thx
RGB
 
You can use the following funtion to return the version number:

Code:
Public Function JetVer(ByVal strPath As String) As Double
On Error GoTo TrapErr

Dim dbs As DAO.Database

Set dbs = OpenDatabase(strPath)

JetVer = dbs.Version

ExitHere:
Exit Function

TrapErr:
Select Case Err.Number
    Case 3033 'Secured database
        JetVer = 0
    Case Else
        JetVer = 9999
End Select
Resume ExitHere

End Function

The version numbers correspond like this:

2 = Access 2
3 = Access 97
4 = Access 2000
and so on...

Ed Metcalfe.

Please do not feed the trolls.....
 
One further point:

You will have problems if the database is secured and you do not know the username/password. In this case you can guess the database version by searching for an MDW file in the same directory and get the version number of that (using the same function I supplied in my previous post).

This method isn't 100% accurate as the MDW file may not be the same version as the database it is used to open, or the MDW file may not belong to the MDB you have found.

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top