How can do I get Network User ID in the MSAccess?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any function or command to get the network UserID (not the database
user id) within a database form? I remember using it in earlier versions of
Access but can not seems to find it in the 2003. Any help will be greatly
appreciated.
 
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Function UserNameWindows() As String

Dim lngLen As Long
Dim strBuffer As String

Const dhcMaxUserName = 255

strBuffer = Space(dhcMaxUserName)
lngLen = dhcMaxUserName
If CBool(GetUserName(strBuffer, lngLen)) Then
UserNameWindows = Left$(strBuffer, lngLen - 1)
Else
UserNameWindows = ""
End If
End Function
 
Back
Top