A. Sunny Okorie
aso...@yahoo.com
>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]
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...
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
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...
>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......
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
>.
>
;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
>.
>
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.
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...
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