Yes, the network login name can be extracted and then stored in a field by using the advapi32.dll in a function. The function would look something like this:-
++++++++++++++
Private Declare Function apiGetLoginName Lib "advapi32.dll" Alias _
"GetLoginName" (ByVal lpBuffer As String, nSize As Long) As Long
+++++++++++++++
Function FGetName() 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 = apiGetLoginName(strUserName, lngLen)
If lngX <> 0 Then
FGetName = Left$(strUserName, lngLen - 1)
Else
FGetName = ""
End If
++++++
'here you can add the code to save the value of FGetName into the table
++++++
End Function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.