How can I detect the current office service pack?

  • Thread starter Thread starter Sydney
  • Start date Start date
S

Sydney

I'm compiling my access db in sp-2 and noticed that users
on sp-1 have some difficutlies with my app.. is there a
way i can detect the current service pack so i can add it
my 'about' screen to aid in trouble shooting?

regards,

Sydney
 
You can detect the path and service pack by using the VB Script below
(modify as needed):

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
 
Back
Top