[AccessD] Recording Windows Version, 32/64 bit, and Access Version

Dan Waters df.waters at comcast.net
Mon Oct 22 19:04:50 CDT 2012


A couple of weeks ago I did some research to record Windows and Access
versions while a person was logging in.  This is what I came up with.

 

HTH!

Dan

 

'---------------------------------------

 

Option Compare Database

Option Explicit

 

Private Type OSVERSIONINFO

    dwOSVersionInfoSize As Long

    dwMajorVersion As Long

    dwMinorVersion As Long

    dwBuildNumber As Long

    dwPlatformId As Long

    szCSDVersion As String * 128

End Type

 

Public Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation
As OSVERSIONINFO) As Integer

 

Private Sub GetWindowsAccessVersion()

 

    '-- This will record the current windows version, whether the OS is 32
bit or 64 bit, and the Access version for the person logging in.

 

    Dim stg As String

    Dim fso As FileSystemObject

    Dim int3264 As Integer

    Dim stgWindowsVersion As String

    Dim stgAccessVersion As String

    

    Set fso = CreateObject("Scripting.FileSystemObject")

    If fso.FolderExists("C:\Windows\sysWOW64") = True Then

        int3264 = 64

    Else

        int3264 = 32

    End If

    

    stgWindowsVersion = WindowsVersion

    stgAccessVersion = Application.Version & " - " & Application.Build

    

    stg = "UPDATE tblPeopleMain SET" _

        & " versionWindows = '" & stgWindowsVersion & "'," _

        & " version3264 = " & int3264 & "," _

        & " versionAccess = '" & stgAccessVersion & "'" _

        & " WHERE PeopleID = " & GV.CurrentPeopleID

    DBEngine(0)(0).Execute stg, dbSeeChanges Or dbFailOnError

    

    Set fso = Nothing

    

End Sub

 

Public Function WindowsVersion() As String

 

    Dim osinfo As OSVERSIONINFO

    Dim retvalue As Integer

    

    osinfo.dwOSVersionInfoSize = 148

    osinfo.szCSDVersion = Space$(128)

    retvalue = GetVersionExA(osinfo)

    

    WindowsVersion = osinfo.dwMajorVersion & "." & osinfo.dwMinorVersion & "
Build (" & osinfo.dwBuildNumber & ") " & fTrimNull(osinfo.szCSDVersion)

 

End Function

 

Private Function fTrimNull(strIn As String) As String

 

    Dim intPos As Integer

    

    intPos = InStr(1, strIn, vbNullChar)

    If intPos Then

        fTrimNull = Mid$(strIn, 1, intPos - 1)

    Else

        fTrimNull = strIn

    End If

    

End Function

 



More information about the AccessD mailing list