I'm trying to capture the network ID user name of the person that last modifies a record in an access form. I'm using access 2010.
I already use this API to get the user name that enters a new record
API: Get Login name
I have tried modifying it so many times to capture the last modified user but I have not been successful.
Has anyone gotten it to work for that purpose?
I appreciate it any help or suggestions.
Thanks! :beer:
I already use this API to get the user name that enters a new record
API: Get Login name
Code:
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
Has anyone gotten it to work for that purpose?
I appreciate it any help or suggestions.
Thanks! :beer: