Solved

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

Posted on 2009-07-14
5
177 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now