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

Dan Waters df.waters at comcast.net
Tue Oct 23 17:45:13 CDT 2012


I didn't know it was faster.  I would have written it like this just for
'visual clarity'.

Thanks!
Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Tuesday, October 23, 2012 4:14 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Recording Windows Version, 32/64 bit, and Access
Version

Why would you rather write it like that?

The original is faster and perfectly valid. 

IF evaluates intPos as a Boolean expression where any non-zero value is True
and zero is False.

I use that construction all the time.

--
Stuart

On 23 Oct 2012 at 10:12, Dan Waters wrote:

> Hi William,
> 
> I had copied and tested that procedure but didn't read it closely.
> 
> It does work correctly though because execution will only pass to the 
> second choice if intPos = 0.
> 
> Still, I would rather write it like this:
> 
>     If intPos <> 0 then
> 
> Dan

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William 
> Benson
> Sent: Tuesday, October 23, 2012 8:37 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Recording Windows Version, 32/64 bit, and 
> Access Version
> 
> 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
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 


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