[AccessD] Track PC Number

jwcolby jwcolby at colbyconsulting.com
Tue Jun 12 06:54:34 CDT 2007


I use the pc name.  There is no reliable serial number or anything like
that, which is pretty silly.

Option Compare Database
Option Explicit

Private Declare Function GetComputerName _
Lib "kernel32" Alias "GetComputerNameA" ( _
       ByVal lpBuffer As String, nSize As Long) As Long

Declare Function GetWinUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long


Private Const MAX_COMPUTERNAME_LENGTH As Long = 15&

Public Function WinMachineName() As String
Dim lSize As Long
Dim sBuffer As String
    sBuffer = Space$(MAX_COMPUTERNAME_LENGTH + 1)
    lSize = Len(sBuffer)

    If GetComputerName(sBuffer, lSize) Then
        WinMachineName = Left$(sBuffer, lSize)
    End If

End Function

Function WinUsername()
Dim strUname As String * 32
Dim lngResponse As Long
    lngResponse = GetWinUserName(strUname, 32)
    If Len(strUname) > 1 Then
        WinUsername = Left$(strUname, InStr(strUname, Chr$(0)) - 1)
    Else
        WinUsername = "No logged In User"
    End If
End Function
 


John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Hollis, Virginia
Sent: Tuesday, June 12, 2007 6:52 AM
To: accessD at databaseadvisors.com
Subject: [AccessD] Track PC Number

Is there a way to track the PC number in a database? For example, when they
open the database it logs the PC number that they used to open the database.

 

Virginia

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