Greetings once again...
SHORT VERSION:
Using Access 2007, can I return a value for CurrentProject.FileFormat WITHOUT opening the database?
LONG VERSION:
I'm looking for a way to determine the file version of a given Access database without actually "opening" the database in Access (I don't want it to ever be visible at all or in any way). I've tried several methods and done a bunch of research, and have come up stumped.
So to open a database in Access 2007 "without opening it," I'm using:
From here, there are at least two different "version" indicators that can be used, as in this example:
Now, if you run this code on an Access 2002/2003 .MDB file, you will get:
If you run this code on an Access 2007 .ACCDB file, you get:
Note two important factors:
Now.... the one way that I have found that ACCURATELY describes the version of a given access database file is to use:
...as this will always return, for example, 2.0 for an Access 2.0 .MDB file; 10 for an Access 2002/03 .MDB file; and 12 for and Access 2007 .ACCDB file (and there are others; these are AcFileFormat bitmask constants as described in Access Help).
BUT, this CurrentProject object doesn't seem to be available (so far as I can see) when using the "open without opening" method described above.
SO, is there any way to return the FileFormat value without opening the database visibly? (Merely basing it in the extension isn't right either.... that would be easy but not accurate as several formats use MDB.)
Thanks Ten-Million in advance for any help...
SHORT VERSION:
Using Access 2007, can I return a value for CurrentProject.FileFormat WITHOUT opening the database?
LONG VERSION:
I'm looking for a way to determine the file version of a given Access database without actually "opening" the database in Access (I don't want it to ever be visible at all or in any way). I've tried several methods and done a bunch of research, and have come up stumped.
So to open a database in Access 2007 "without opening it," I'm using:
Code:
Dim db As DAO.Database
Set db = DBEngine.Workspaces(0).OpenDatabase("C:\Path-To\File.accdb")
From here, there are at least two different "version" indicators that can be used, as in this example:
Code:
Debug.Print db.Properties("Version").Value
Debug.Print db.Properties("AccessVersion").Value
Now, if you run this code on an Access 2002/2003 .MDB file, you will get:
Code:
4.0
09.50
If you run this code on an Access 2007 .ACCDB file, you get:
Code:
12.0
09.50
Note two important factors:
- The db.Properties("Version") seems to be returning the JET version from what I can see in research. This is NOT what I'm after.
- The db.Properties("AccessVersion") returns THE SAME VALUE for an '07 ACCDB as it does for an '02-'03 MDB, since Microsoft never updated it, apparently.
Now.... the one way that I have found that ACCURATELY describes the version of a given access database file is to use:
Code:
Debug.Print CurrentProject.FileFormat
...as this will always return, for example, 2.0 for an Access 2.0 .MDB file; 10 for an Access 2002/03 .MDB file; and 12 for and Access 2007 .ACCDB file (and there are others; these are AcFileFormat bitmask constants as described in Access Help).
BUT, this CurrentProject object doesn't seem to be available (so far as I can see) when using the "open without opening" method described above.
SO, is there any way to return the FileFormat value without opening the database visibly? (Merely basing it in the extension isn't right either.... that would be easy but not accurate as several formats use MDB.)
Thanks Ten-Million in advance for any help...
