Is there VB Code That Identifies a MDB file as Version 2000, 2002, 2003 ?

W

WhatTha

Is there VB Code That Identifies a MDB file as Version 2000, 2002, 2003
?

Can anyone point me to such code or a website that has this code....
thanks..

cj...
 
D

Danyx

Hy

If you want to see the Access Version you have to use this code:

Application.Version ' this code returns a string

if you need to return a number use this Val(Application.Version)
 
G

Graham R Seach

There's also CurrentProject.FileFormat. The following is taken directly from
Access 2003 Help.

Dim strFormat As String

Select Case CurrentProject.FileFormat
Case acFileFormatAccess2
strFormat = "Microsoft Access 2"
Case acFileFormatAccess95
strFormat = "Microsoft Access 95"
Case acFileFormatAccess97
strFormat = "Microsoft Access 97"
Case acFileFormatAccess2000
strFormat = "Microsoft Access 2000"
Case acFileFormatAccess2002
strFormat = "Access 2002 - 2003"
End Select

MsgBox "This is a " & strFormat & " project."

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
W

WhatTha

Thank you for taking the time to answer my question but i am trying to
find info about an access database FROM VB6 code... from a VB6 project
i would like to write code that could look at a mdb file and read its
Access Object Library number -so i would know its version...

does anyone know the VB6 code that will detail what the Microsoft
Access Object library number is from outside the file... and from VB6
code... thanks

cj...
 
G

Graham R Seach

Either way, you'll need to open Access up and look at its properties. To do
that, you'll still need to declare an Access object, execute
OpenCurrentDatabase, and set a reference to CurrentDb. Then if you want to
check its version, you have to check (as Danyx suggested) the AccessVersion
property, or (as I suggested) the FileFormat property. If you want to check
the library version, you have to check the References collection to get the
Reference object and its Major and Minor properties.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
W

WhatTha

Thank you Graham - (Mate) - That about nails it... and thankyou Danyx
too... for the alternative way to approach the problem...

cj...
 
Top