Getting the name of the computer

BroncoMarc

Registered User.
Local time
Today, 19:34
Joined
Apr 4, 2002
Messages
43
I want to put a field on my form that shows the last person to edit the record (in case someone screws something up).

The easiest way to do this that I can think of is to just use VB to grab the name of the computer. How can I do this?

Thanks,
- Marc
 
I do......

Option Compare Database
'Masterform LastEditedBy code
'Benjamin Linville
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetNTUser() As String
On Error GoTo Err_GetNTUser
Dim strUserName As String
strUserName = String(100, Chr$(0))
GetUserName strUserName, 100
strUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)
GetNTUser = StrConv(strUserName, vbProperCase)
Exit_GetNTUser:
Exit Function
Err_GetNTUser:
MsgBox "GetNTUser", Err.Number, Err.DESCRIPTION
Resume Exit_GetNTUser
End Function

Private Sub Account___AfterUpdate()
Me.LastEditedBy.Value = GetNTUser & " " & Date & " " & Time
End Sub
 

Users who are viewing this thread

Back
Top Bottom