Solved

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

Posted on 2009-07-14
5
202 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 - Microsoft MVP, Access and Data Platform) 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

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…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

830 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