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

William Benson vbacreations at gmail.com
Tue Oct 23 08:36:57 CDT 2012


If intPos is an integer why are you testing it like a boolean?
On Oct 22, 2012 8:05 PM, "Dan Waters" <df.waters at comcast.net> wrote:

> 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
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list