Solved

How do I programmatically detect the file format of a Microsoft Access file?

Posted on 2009-07-14
5
196 Views
Last Modified: 2013-11-27
I'm writing a program in Visual Basic .NET 2008 to automatically update old versions of Microsoft Access files (97) to 2003 format. That's working fine. What I'm looking for is a way to check the file format of an Access file before trying to convert it. If the file is already in the correct format, I want to skip the conversion process.
0
Comment
Question by:Richard Senft
5 Comments
 
LVL 75
ID: 24852904
Well, inside of Access you can use the SysCmd to get this - for example:

   If SysCmd(acSysCmdAccessVer) = 11 Then
    MsgBox "Access 2003"
   End If

mx
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 24852924
However ... this is more general purpose:

http://www.mvps.org/access/api/api0065.htm

mx
0
 
LVL 44

Expert Comment

by:Leigh Purvis
ID: 24854401
Are you refering to Access "files" as in the MDBs (perhaps even ACCDBs) for conversion and want to externally determine their version?
Bearing in mind this is all in VBA (and from Access itself - but VBA is the only real factor) this link discusses the nuances of MDB and ACCDB version format info accessed via DAO or ADO.
You'll need to invoke the equivalent in VB - though you could always use one of the "old" COM libraries if required. :-p
Cheers.
0
 
LVL 41

Expert Comment

by:graye
ID: 24864373
I think the only way to figure out the version number is to go ahead and open up the MDB file using the OleDb.Jet drivers.   You'll be able to get the Major and Minor version numbers as properties.
But that obviously doesn't help you much... as that means you'll have to open the MDB twice... once to get the version number and again to perform the conversion... a hollow victory
0
 

Author Closing Comment

by:Richard Senft
ID: 31603424
Thanks!
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question