Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to deletect Access version from MDB

82 views
Skip to first unread message

David Aylott

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
G'day

I am working in an environment where users have some Access 2.0
databases and some in Access 97 (possibly even some Access 95 and
2000).

What I would like to do is write a front-end (eg in VB) that I can
associate with the .MDB file so that when users double click the MDB,
it examines the file and opens the correct version of Access.

I have a hex dump of the .MDB files and there do seem to be some areas
in common so I could hopefully check a few bytes in the header of the
MDB and work out the version.

Does anyone know a reliable way to determine which version of Access
created an MDB file??

Any help gratefully received - and an e-mail response would be
appreciated. My e-mail address is valid for your convenience.

Thanks

,-._|\ David Aylott (Melbourne, Australia)
/ Oz \ day...@bigfoot.com
\_,--.x/ Shareware, FAQ, hints & tips all at:
v http://www.bigfoot.com/~daylott/

Dev Ashish

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
Hi David,

You can use the unsupported AccessVersion property. A sample is as
follows

'****** Code Start *********
Function fIs97MDB(strRemoteDB As String) As Boolean
Dim lowrk As DAO.Workspace
Dim lodb As DAO.Database
On Error GoTo Err_handler

Set lowrk = CreateWorkspace("DownsizerWorkSpace", "Admin", "", dbUseJet)
Set lodb = lowrk.OpenDatabase(strRemoteDB)
With lodb
fIs97MDB = (.Properties("AccessVersion") > "07.00")
End With
Exit_Here:
lodb.Close
Set lodb = Nothing
lowrk.Close
Set lowrk = Nothing
DoEvents
Exit Function
Err_handler:
fIs97MDB = False
Resume Exit_Here
End Function
'********* Code End ******

--- Dev

David Aylott <day...@bigfoot.com> wrote in message
news:37a80bc1...@news.melbpc.org.au...
: G'day

Michael (michka) Kaplan

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
I believe there is a supported SysCmd that returns the same
prop... but the advantage of doing it via DAO is that you do
not have to start Access to check it.

--
MichKa

-------------------------------------
don't send questions by e-mail unless
you're paying for it. (TANSTAAFL!) :-)

random junk of dubious value is at:
http://www.trigeminal.com

Dev Ashish <das...@hotmail.com> wrote in message
news:7oa64s$c2e$1...@bgtnsc02.worldnet.att.net...

Dev Ashish

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
Thanks Michael... Just for completeness, I think Michael's referring to

?SysCmd(acSysCmdAccessVer)

-- Dev

Michael (michka) Kaplan <forme...@spamless.trigeminal.com> wrote in
message news:#xWGn1r3#GA.429@cpmsnbbsa02...
: I believe there is a supported SysCmd that returns the same

: >
: >
:
:

Michael (michka) Kaplan

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
Yes, but your solution is better... you can use DAO 3.6 to
try it out which will work on all versions) and then shell
to the appropriate Access based on its response.

--
MichKa

-------------------------------------
don't send questions by e-mail unless
you're paying for it. (TANSTAAFL!) :-)

random junk of dubious value is at:
http://www.trigeminal.com

Dev Ashish <das...@hotmail.com> wrote in message

news:7oaah9$rnj$1...@bgtnsc02.worldnet.att.net...

Michael (michka) Kaplan

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
Not sure what code you tried, which makes it hard to
comment.

--
MichKa

-------------------------------------
don't send questions by e-mail unless
you're paying for it. (TANSTAAFL!) :-)

random junk of dubious value is at:
http://www.trigeminal.com

Martin Connelly <ai...@FreeNet.Carleton.CA> wrote in message
news:7odeam$2...@freenet-news.carleton.ca...
>
> Tried this code over all the files on a disk
> and routine expired and hung under following
> file conditions.
> Read only mdb
> access2000 mdb when running from A97
> permission restricted mdb
> I would expect it too raise an error code of 3343,3033,or
3051
> but no error just hangs. Any idea why?
>
> Although it reads 1.1 mdb files even though no property
exist.
>
> "Michael Kaplan" (forme...@spamless.trigeminal.com)
writes:


> > Yes, but your solution is better... you can use DAO 3.6
to
> > try it out which will work on all versions) and then
shell
> > to the appropriate Access based on its response.
> >
> > --
> > MichKa
> >
> > -------------------------------------

> > Dev Ashish <das...@hotmail.com> wrote in message
> > news:7oaah9$rnj$1...@bgtnsc02.worldnet.att.net...
> >> Thanks Michael... Just for completeness, I think
Michael's
> > referring to
> >>
> >> ?SysCmd(acSysCmdAccessVer)
> >>
> >> -- Dev
> >>
> >> Michael (michka) Kaplan
> > <forme...@spamless.trigeminal.com> wrote in
> >> message news:#xWGn1r3#GA.429@cpmsnbbsa02...
> >> : I believe there is a supported SysCmd that returns
the
> > same
> >> : prop... but the advantage of doing it via DAO is that
> > you do
> >> : not have to start Access to check it.
> >> :
> >> : --
> >> : MichKa
> >> :
> >> : -------------------------------------
> >> :

> --
> Marty Connelly ai...@ncf.ca Victoria BC, Canada

Martin Connelly

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to

Martin Connelly

unread,
Aug 7, 1999, 3:00:00 AM8/7/99
to

I took a stab at rewriting Dev's Code. I need to check all mdb files on a
disk to determine their version no. There seem to be a lot of Gotcha's.
Will there be anymore problems if using open read-only rather than
an exclusive open?

Option Compare Database
Option Explicit

'You can use the unsupported AccessVersion property. A
' : sample is as follows
'from Dev Ashish's code

'****** Code Start *********
Function fIs97MDBVer(strRemoteDB As String) As String


Dim lowrk As DAO.Workspace
Dim lodb As DAO.Database

'to find Access MDB file version number
' using Access 97 DAO 3.5
' filename and path strRemoteDB beter exist or you will hang in here

fIs97MDBVer = " "
On Error GoTo Err_handler

Set lowrk = DBEngine.CreateWorkspace("DownsizerWorkSpace", _
"Admin", "", dbUseJet)
' Open Database Exclusively
' If used will litter disk with .ldb files
' and you will get possible 3051 errors
'
' Set lodb = lowrk.OpenDatabase(strRemoteDB)

' Open Database Read Only
Set lodb = lowrk.OpenDatabase(strRemoteDB, False, True)

With lodb

fIs97MDBVer = .Properties("AccessVersion")
'fIs97MDBVer = (.Properties("AccessVersion") > "07.00")
Debug.Print strRemoteDB, .Properties("AccessVersion")
'Property will return "07.53" Access 97
' "06.68" Access 95
' "02.00" Access 2.0
' other than that rely on error messages to
' find file version
End With
Exit_Here:
lodb.Close
Exit_Here_NoPassword:


Set lodb = Nothing
lowrk.Close
Set lowrk = Nothing

DoEvents

Exit Function
Err_handler:

Dim strError As String
Dim errLoop As Error
Dim Response As Integer

' Enumerate Errors collection and display properties of
' each Error object.
For Each errLoop In Errors
With errLoop
strError = _
"Error #" & .Number & vbCr
strError = strError & _
" " & .Description & vbCr
strError = strError & _
" (Source: " & .Source & ")" & vbCr
strError = strError & _
"Press F1 to see topic " & .HelpContext & vbCr
strError = strError & _
" in the file " & .HelpFile & "."
End With

Response = MsgBox(strError, vbOKCancel)

'3031 bail out of here if password protected
'3343 unrecognized database probably Access 2000
'3270 property not found probably Access 1.0 or 1.1
' but database still opened so close
'3051 File already opened as Exclusive or badly closed
' only occurs if database opened as Exclusive
' rather than read only open

If (Err = 3031) Then
fIs97MDBVer = "Password Protected Unknown"
End If
If (Err = 3051) Then
fIs97MDBVer = "Exclusive Block Unknown"
End If
If (Err = 3270) Then
fIs97MDBVer = "1.0 or 1.1"
End If
If (Err = 3343) Then
fIs97MDBVer = "Possible Access 2000 or bad file"
End If
'can't close database anyway,never opened so skip close

If (Err = 3031 Or Err = 3343 Or Err = 3051) Then
Resume Exit_Here_NoPassword
End If

If Response = 2 Then 'cancel
Resume Exit_Here
End If
Next

fIs97MDBVer = fIs97MDBVer & False & Err.Number & Err.Description


Resume Exit_Here
End Function
'********* Code End ******

David Aylott

unread,
Aug 8, 1999, 3:00:00 AM8/8/99
to
BRILLIANT!!

That was exactly what I wanted.

I did have a few problems (using VB5 by the way):

1. It did not compile! To fix this, select Project / References and
make sure that 'MS DAO 3.52 Object Library' is checked.

2. Problems with Read Only databases - fixed by using the read-only
flag in OpenDatabase

3. Problems with protected databases from v2.0. Fixed by getting the
Jet version instead of the property.

4. File may be in use. Fixed with error handler.

Here is the code I used:

Function MDBVersion(strRemoteDB As String) As String


Dim lowrk As DAO.Workspace
Dim lodb As DAO.Database

On Error GoTo Err_handler

Set lowrk = CreateWorkspace("CheckVersion", "admin", "", dbUseJet)
Set lodb = lowrk.OpenDatabase(strRemoteDB, True, True)

' Properties does not work for protected databases so use Jet
Version instead
' NB untested with Access95 and 97 protected files
' Version = 3.0 for Access95 and 97
If lodb.Version >= "3.0" Then
MDBVersion = lodb.Properties("AccessVersion")
Else
MDBVersion = lodb.Version
End If

Exit_Here:
On Error Resume Next
lodb.Close


Set lodb = Nothing
lowrk.Close
Set lowrk = Nothing
DoEvents
Exit Function
Err_handler:

If Err = 3045 Then ' File is In Use
MDBVersion = "In Use"
Else
MDBVersion = "Unknown"
End If
Resume Exit_Here
End Function

Thanks again for your assistance...

Don Leverton

unread,
Aug 11, 1999, 3:00:00 AM8/11/99
to
Hi Martin,
Something else that may or may not work (I think you have to have ALL
versions installed?) is a program called VCHECK by Wickless Consulting
e-mail to ma...@wickless.com, or visit http://www.webworldwide.com )

It is shareware, and I was using it for a short time shortly after upgrading
to Access97. (No I never did end up buying it, and I am not using it
anymore.)

It DID used to function properly when I DID have all three versions. (2.0,
7.0, 8.0)
But after I had to re-format my hard drive and re-install all programs on my
machine (after getting the Chernobyl virus!) I decided to re-install 2.0 and
97 only, as I had absolutely no desire to have A95 (7.0)

When I did try to open an A97 MDB my experience was that it reported a
problem and wanted me to manually enter the path to version 7.0, which of
course it could no longer find as it was not installed. I never persued it
any further than this, as I was committed to using A97 for everything new.

HTH,
Don
--
=====================================
My credentials and areas of expertise:
Ford Parts experience ....................14 yrs
UAP/NAPA parts exp ..................... 6 yrs
Computer Geek ................................. 8 yrs
M/S Access user ............................... 5 yrs
Access Developer ..... What time is it? {:o)
Replace "DontSpamMe" with "leverite" for mail
=====================================


Martin Connelly <ai...@FreeNet.Carleton.CA> wrote in message

news:7ohto8$e...@freenet-news.carleton.ca...

David Aylott

unread,
Aug 22, 1999, 3:00:00 AM8/22/99
to
Thanks to everyone who helped me with this project.

I have finshed the program and released it as 'trialware'. If you
would like to try a copy, goto the software page at my web site
(http://www.bigfoot.com/~daylott/) and look for ACCVER.

An essential tool for developers and users working with multiple
versions of MS Access.

ACCVER v0.8 - Allows you to work with
multiple versions of MS Access databases.
Detects the version of Access used to create
your MDB or MDA files and either reports the
version number or starts the appropriate
version of MS Access.
Windows Software from Aylott Computing. $5

Comments and suggestions gratefully received.

---------------------------------

day...@bigfoot.com (David Aylott) wrote:

>G'day
>
>I am working in an environment where users have some Access 2.0
>databases and some in Access 97 (possibly even some Access 95 and
>2000).
>
>What I would like to do is write a front-end (eg in VB) that I can
>associate with the .MDB file so that when users double click the MDB,
>it examines the file and opens the correct version of Access.
>
>I have a hex dump of the .MDB files and there do seem to be some areas
>in common so I could hopefully check a few bytes in the header of the
>MDB and work out the version.
>
>Does anyone know a reliable way to determine which version of Access
>created an MDB file??
>
>Any help gratefully received - and an e-mail response would be
>appreciated. My e-mail address is valid for your convenience.
>

,-._|\ David Aylott (Melbourne, Australia)

0 new messages