Wednesday, July 9, 2008

Get the current version of Access using VBA

Sometimes it is useful to know what version of Access your Access application is running under. Below is a function that will return the current running version of Access.


'Return a string according to the current access version
Public Function GetAccessVersion() As String
Dim sVersion As String

sVersion = SysCmd(acSysCmdAccessVer)

Select Case sVersion
Case "8.0"
GetAccessVersion = "97"
Case "9.0"
GetAccessVersion = "2000"
Case "10.0"
GetAccessVersion = "2002"
Case "11.0"
GetAccessVersion = "2003"
Case "12.0"
GetAccessVersion = "2007"
Case Else
GetAccessVersion = "Future Version: " & sVersion
End Select
End Function

No comments: