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

How to detect MS Access Version Installed on PC in VB

19 views
Skip to first unread message

Sunny Okorie

unread,
Jan 1, 2004, 4:22:32 PM1/1/04
to
How can detect MS Access version installed on a PC using
Visual Basic code.
I'd like to if it is version '97, 2000, or 2002.
Thanks for your help, links or other references.

A. Sunny Okorie
aso...@yahoo.com

Marshall Barton

unread,
Jan 1, 2004, 5:27:07 PM1/1/04
to
Sunny Okorie wrote:

>How can detect MS Access version installed on a PC using
>Visual Basic code.
>I'd like to if it is version '97, 2000, or 2002.

SysCmd(acSysCmdAccessVer)

Will tell you the version:
8 - A97
9 - A2K
10 - A2002
11 - A2003
--
Marsh
MVP [MS Access]

Larry Linson

unread,
Jan 1, 2004, 9:27:20 PM1/1/04
to
That will tell you what version of Access is running the Access database in
which you issue the statement.

Multiple versions of Access may be installed on the same computer, and I
don't know of any simple way to determine that, if that was the desire
rather than what version am I using.

Larry Linson
Microsoft Access MVP

"Marshall Barton" <marsh...@wowway.com> wrote in message
news:0h79vv8c9rjqtvfqu...@4ax.com...

JSand42737

unread,
Jan 1, 2004, 9:40:15 PM1/1/04
to
In article <#vRNdfN0...@TK2MSFTNGP11.phx.gbl>, "Larry Linson"
<bou...@localhost.not> writes:

If I had to detect which versions of Access were installed, I would use the API
calls FindFirstFile and FindNextFile to find all instances of msaccess.exe on
the computer, and then use something like the code on The Access Web to
determine the version - http://www.mvps.org/access/api/api0065.htm.

Doable, but I am sure that there are a few pitfalls along the way.....


--

Jon

www.applecore99.com - Access Tips and Tricks

Larry Linson

unread,
Jan 1, 2004, 11:19:08 PM1/1/04
to
Yep, I don't consider any "API solution" to be a "simple" one. Well, maybe
using the Windows Common Dialog, first one at the FAQ site, is in the
"simple" category. But the mere mention of API sends some scurrying for
cover.

If you put enough time and effort into learning APIs and using them, you can
accomplish a great deal. But, "time" and "effort" are operative words in
that statement.

Larry Linson
Microsoft Access MVP


"JSand42737" <jsand...@aol.com> wrote in message
news:20040101214015...@mb-m16.aol.com...

JSand42737

unread,
Jan 1, 2004, 11:59:39 PM1/1/04
to
In article <#Gyo7dO0...@TK2MSFTNGP12.phx.gbl>, "Larry Linson"
<bou...@localhost.not> writes:

>Yep, I don't consider any "API solution" to be a "simple" one. Well, maybe
>using the Windows Common Dialog, first one at the FAQ site, is in the
>"simple" category. But the mere mention of API sends some scurrying for
>cover.
>
>If you put enough time and effort into learning APIs and using them, you can
>accomplish a great deal. But, "time" and "effort" are operative words in
>that statement.
>
> Larry Linson
> Microsoft Access MVP

Well, using the code from The Access Web at
http://www.mvps.org/access/api/api0065.htm, together with code for
FindFirstFile/FindNextFile from my site at
http://www.applecore99.com/api/api011.asp, I put something together in a few
minutes that seems to work......

Scott McDaniel

unread,
Jan 2, 2004, 7:57:02 AM1/2/04
to
Information about Office programs is stored in registry keys. For example,
if you have AccessXP installed then this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0\Access\InstallRoot

will exist and will hold the location of MSAccess.exe that is associated
with XP. You could then navigate to that folder and examine the msaccess.exe
executable found there to determine exact service packs and such. Other
versions are available as well; 8.0 is A97, 9.0 is A2000 etc etc

Reading the registry is simple; there are lots of code snippets avaialbe to
read/write registry keys.
--
Scott McDaniel
CS Computer Software
www.thedatabaseplace.net

"JSand42737" <jsand...@aol.com> wrote in message

news:20040101235939...@mb-m16.aol.com...

Sunny

unread,
Jan 2, 2004, 12:31:13 PM1/2/04
to
Marsh,
What's the useage of the SysCmd(acSysCmdAccessVer)in VB?
I'm not familiar with it - could you show me how to apply
it?
Thanks for your help.

Sunny

>.
>

Sunny

unread,
Jan 2, 2004, 12:44:05 PM1/2/04
to
Larry,
I know you can install multiple versions. However, the
typical user would not.
This article seem to captures what I need from the Windows
Registry entry, but I don't know the language they've used
or how to port that to VB?
would you know?

;Inno Setup Extensions Knowledge Base
;Article 20 - How to detect if and which version of MS
Access is installed
;http://www13.brinkster.com/vincenzog/isxart.asp?idart=20
...
if RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\MSACCESS.EXE',
'', accpath) then

>.
>

Marshall Barton

unread,
Jan 2, 2004, 3:25:43 PM1/2/04
to
Sunny wrote:
>What's the useage of the SysCmd(acSysCmdAccessVer)in VB?
>I'm not familiar with it - could you show me how to apply


Dim strAccessVersion As String
strAccessVersion = syscmd(acSysCmdAccessVer)
Debug.Print "This program uses Access " & strAccessVersion

But as others have noted, this only tells you which version
is running that code. What other versions may be installed
on the machine is an entirely different matter.

Douglas J. Steele

unread,
Jan 2, 2004, 4:19:44 PM1/2/04
to
Looking at the home page for that site, it says "This knowledge base is born
to help programmers to make installer packages using Inno Setup Extensions"

All you need, though, is code that will let you read the registry. There's
one approach in http://www.mvps.org/access/api/api0015.htm at "The Access
Web".

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Sunny" <aso...@yahoo.com> wrote in message
news:07dc01c3d158$0460b600$a501...@phx.gbl...

Paul Overway

unread,
Jan 2, 2004, 5:17:28 PM1/2/04
to
Sample VB Script follows:

Dim i
Dim strPath
Dim strVersion

For i = 8 to 11
strPath = GetAccessPath(i)
strVersion = GetVersion(strPath)

If Len(strPath) Then
msgbox "Microsoft Access version " & strVersion & " is installed at
" & strPath,64,"Found It"
End if
Next

Function GetAccessPath(Version)

Dim wsh
Dim strValue

On error resume next

Set wsh = CreateObject("Wscript.Shell")

strValue = wsh.RegRead("HKCR\Access.Application." & Version &
"\Shell\Open\Command\")

GetAccessPath = StripIt(strValue)

End Function

Function StripIt(Arg)
'Removes any command line parameters or quotes from the string

If InStr(Arg, "/") > 0 Then
StripIt = Trim(Left(Arg, InStr(Arg, "/") - 1))
Else
StripIt = Arg
End If

If Left(StripIt, 1) = Chr(34) Then
StripIt = Mid(StripIt, 2)
End If

If Right(StripIt, 1) = Chr(34) Then
StripIt = Left(StripIt, Len(StripIt) - 1)
End If

End Function

Function GetVersion(FilePath)
'Returns version for FilePath
Dim fso, temp

On Error Resume Next

Set fso = CreateObject("Scripting.FileSystemObject")

temp = fso.GetFileVersion(FilePath)

If Len(temp) Then
GetVersion = temp
Else
GetVersion = 0
End If

End Function

--
Paul Overway
Logico Solutions, LLC
www.logico-solutions.com


"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:eN4eEZX0...@TK2MSFTNGP10.phx.gbl...

Sunny Okorie

unread,
Jan 5, 2004, 1:11:27 PM1/5/04
to
Thanks Paul,
This was my best answer...

Sunny

0 new messages