Who is log in

Maritza

Information *****
Local time
Today, 09:27
Joined
Nov 13, 2002
Messages
54
I need to track who inputted each record in the DB everytime that we add a record. Searching the knowlege base website I founf this function. This function works on a standalone computer, but it doesn't work over the network. Does anybody have a routine that can do that, or can point me in the right direction. We are using Access 2000 on an XP environment.


Function GetUserName()

' Buffer size for the return string.
Const lpnLength As Integer = 255

' Get return buffer space.
Dim status As Integer

' For getting user information.
Dim lpName, lpUserName As String

' Assign the buffer size constant to lpUserName.
lpUserName = Space$(lpnLength + 1)

' Get the log-on name of the person using product.
status = WNetGetUser(lpName, lpUserName, lpnLength)

' See whether error occurred.
If status = NoError Then
' This line removes the null character. Strings in C are null-
' terminated. Strings in Visual Basic are not null-terminated.
' The null character must be removed from the C strings to be used
' cleanly in Visual Basic.
lpUserName = Left$(lpUserName, InStr(lpUserName, Chr(0)) - 1)
strUserName = lpUserName
Else
' An error occurred.
MsgBox "Unable to get the name."
End
End If

' Display the name of the person logged on to the machine.
MsgBox "The person logged on this machine is: " & lpUserName

End Function

Thanks
 
Thanks a lot, I'm going to try it right now.
 

Users who are viewing this thread

Back
Top Bottom