Question determine MS Access version by binary read of mdb,mde (1 Viewer)

dmcdivitt

Registered User.
Local time
Yesterday, 20:02
Joined
Mar 12, 2009
Messages
28
Sometime ago I wrote a VB6 program to launch the correct version of MS Access, depending on what version a file was made with. The program grabs all the MS Access file types when it loads and after a delay does the same again. Upon clicking an MS Access file type, the program reads the first 176 bytes from the file then launches either Access 97 or Access 2000 depending on what's found.

I'm having to maintain several old databases, continuing with the same version. Users also need help opening the right version of Access for a file. The program needs to be updated. All I have myself is 97 and 2000, but users have all subsequent versions. I have no way of creating sample files for each of the versions so I can see what they contain.

My logic to determine 97 or 2000 in the first 176 bytes is, if the string "Standard Jet" is not found or if the string "4.0" is found, the file is 2000. Otherwise it is 97. The location of the MS Access exe is then fetched from the shell\open\command value in the registry for that version.

Can someone please say what info in the fle indicates the version created with, for all versions? I will make the updated program available for anyone who wants it. Thanks
 

ByteMyzer

AWF VIP
Local time
Yesterday, 18:02
Joined
May 3, 2004
Messages
1,409
Instead of trying to determine the version by a binary file read, why not use the GetFileVersion method of the FileSystemObject?

Code:
[COLOR="Navy"]Dim[/COLOR] objFSO [COLOR="navy"]As Object
Dim[/COLOR] sAccessDir [COLOR="navy"]As String
Dim[/COLOR] sFileVersion [COLOR="navy"]As String
Dim[/COLOR] sHKLM [COLOR="navy"]As String
Dim[/COLOR] WshShell [COLOR="navy"]As Object

Set[/COLOR] WshShell = CreateObject("WScript.Shell")

[COLOR="DarkGreen"]' Determine 32/64-bit Processor Architecture[/COLOR]
[COLOR="navy"]If[/COLOR] InStr(1, _
    WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%"), _
    "64") > 0 [COLOR="navy"]Then[/COLOR]
    sHKLM = "HKLM\SOFTWARE\Wow6432Node\"
[COLOR="navy"]Else[/COLOR]
    sHKLM = "HKLM\SOFTWARE\"
[COLOR="navy"]End If[/COLOR]

[COLOR="darkgreen"]' Retrieve the directory for MSACCESS.EXE[/COLOR]
sAccessDir = WshShell.RegRead(sHKLM _
    & "Microsoft\Windows\CurrentVersion\App Paths\MSACCESS.EXE\Path")

[COLOR="navy"]Set[/COLOR] WshShell = [COLOR="navy"]Nothing

Set[/COLOR] objFSO = CreateObject("Scripting.FileSystemObject")
sFileVersion = objFSO.GetFileVersion(sAccessDir & "MSACCESS.EXE")
[COLOR="navy"]Set[/COLOR] objFSO = [COLOR="navy"]Nothing

Select Case[/COLOR] Split(sFileVersion, ".")(0)
    [COLOR="navy"]Case[/COLOR] "8"
        [COLOR="darkgreen"]' 97[/COLOR]
    [COLOR="navy"]Case[/COLOR] "9"
        [COLOR="darkgreen"]' 2000[/COLOR]
    [COLOR="navy"]Case[/COLOR] "10"
        [COLOR="darkgreen"]' 2002[/COLOR]
    [COLOR="navy"]Case[/COLOR] "11"
        [COLOR="darkgreen"]' 2003[/COLOR]
    [COLOR="navy"]Case[/COLOR] "12"
        [COLOR="darkgreen"]' 2007[/COLOR]
[COLOR="navy"]End Select[/COLOR]
 

dmcdivitt

Registered User.
Local time
Yesterday, 20:02
Joined
Mar 12, 2009
Messages
28
I need to know what version of access to open MDB files with. Users have multiple versions of access. If they don't have that version installed, I do not want the file to open for them. I do not want any conversion prompts. I want this integrated with Wondows Explorer so users can just double click on a file to open it.

What I have works well for 97 and 2000. I'm getting reinvolved with a few things and need to update the decision logic in the program. I need to know how to identify mdb files created by later versions of access, by examining the first 256 or so bytes of the file.

There is no other way to accomplish this except the way I describe. It's also the easiest way, but I don't have file examples to look at that have been made with different versions.
 

boblarson

Smeghead
Local time
Yesterday, 18:02
Joined
Jan 12, 2001
Messages
32,059
I need to know how to identify mdb files created by later versions of access, by examining the first 256 or so bytes of the file.
Remember there are now a few other file extensions to be concerned with. It isn't just mdb, but you have mde, ACCDB, ACCDE, ACCDR.
but I don't have file examples to look at that have been made with different versions.
Perhaps you should go to UTTER ACCESS and look around as they have posts marked based on the version people are using and then you might be able to get a sample. I can give you a sample of a 2002-2003 db right now. I can possibly upload a sample of a few Access 2007 files later.
 

Attachments

  • 2002-2003Format.mdb
    292 KB · Views: 240

dmcdivitt

Registered User.
Local time
Yesterday, 20:02
Joined
Mar 12, 2009
Messages
28
Thanks for that! Are 2002 and 2003 equivalent? Do they open each other's files without conversion? I can do 2007 at home. I'm not worried about newer file types - only mdb and mde at this time.
 

boblarson

Smeghead
Local time
Yesterday, 18:02
Joined
Jan 12, 2001
Messages
32,059
Thanks for that! Are 2002 and 2003 equivalent? Do they open each other's files without conversion?

Supposedly they are synonymous (I say supposedly because they are supposed to be but I find it interesting that you can have new features in Access 2003 but not in 2002 and still run the files).
 

dmcdivitt

Registered User.
Local time
Yesterday, 20:02
Joined
Mar 12, 2009
Messages
28
Attached is a module from my VB6 program, updated for later versions of access. The program has no form and only this module.
 

Attachments

  • ChooseAccessModule.zip
    1.5 KB · Views: 548

Users who are viewing this thread

Top Bottom