I have code below which determines the version of Access. It runs quickly on most PCs. We also have four terminal servers. On two of the terminal servers it runs fine. On the other two, this code takes over 15 seconds to run.
All four terminal servers have Access 2003 runtime. I can't figure out why it would take longer to run on two servers. Would it be permissions? Or some mistake in the way the Access runtime was installed?
If there is a better, quicker way of determining the Version, I'd be interested in that too. Thanks Awesomo
' Determine the Access version by creating an
' Access.Application object and looking at
' its Version property.
Private Function GetAccessVersionName() As String
Dim obj As Object = CreateObject("Access.Application")
Dim result As String = "Access.Application." & _
obj.Version
obj.Quit()
Return result
End Function
' Get the Access version number from the name.
Private Function GetAccessVersionNumber() As Integer
Dim txt As String = GetAccessVersionName()
Dim pos2 As Integer = txt.LastIndexOf(".")
Dim pos1 As Integer = txt.LastIndexOf(".", pos2 - 1)
txt = txt.Substring(pos1 + 1, pos2 - pos1 - 1)
Return CInt(txt)
End Function
' Get the nice style of the Access version name.
Public Function GetAccessVersionNiceName() As String
Try
Select Case GetAccessVersionNumber()
Case 8
Return "Access 97"
Case 9
Return "Access 2000"
Case 10
Return "Access XP"
Case 11
Return "Access 2003"
Case 12
Return "Access 2007"
Case Else
Return "unknown"
End Select
Catch ex As Exception
Return "unknown"
End Try
End Function