While looking up something else in the Access documentation we ran across a property named FileFormat. FileFormat is the property that tells us which version of Access was used to create a database. Want to know which version of Access was used to create the database flight32.mdb? ( The flight application’s QTP demo ) Here you go:
Set access = CreateObject( "Access.Application" )
flight32 = Environment( "ProductDir" ) & "\samples\flight\app\flight32.mdb"
access.OpenCurrentDatabase flight32
formatNum = access.CurrentProject.FileFormat
Select Case formatNum
Case 2 Print "Microsoft Access 2"
Case 7 Print "Microsoft Access 95"
Case 8 Print "Microsoft Access 97"
Case 9 Print "Microsoft Access 2000"
Case 10 Print "Microsoft Access 2003"
End Select
Note. By default, Access will present you with a dialog box asking if you really want to open the database. To bypass that warning, set your macro security level to Low.
We begin by creating an instance of the Access.Application object, then we use the OpenCurrentDatabase method to open the file flight32.mdb. We then use this line of code to get the value of the FileFormat property and store that value in a variable named formatNum:
formatNum = access.CurrentProject.FileFormat
All that’s left now is to set up a Select Case statement to examine the value of formatNum and print the corresponding version of Microsoft Access.
Based on "How Can I Determine Which Version of Access was Used to Create a Database? " from the Scripting Guys
Posted in MS Applications, MS-Access

daniva




Recent Comments