?
Solved

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

Posted on 2009-07-14
5
Medium Priority
?
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 - Microsoft MVP, Access and Data Platform) earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

777 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