Access/VBA Library

WindowsUserId

Returns the Windows user id of the current user.

Syntax

WindowsUserId()
Return value

String : The userid of the current user.

Code
Function WindowsUserId() As String
     Dim Buffer As String * 25
     Dim result As Long
     Dim UserName As String
        
     ' Get the username and store in buffer
     result = GetUserID(Buffer, 25)
     ' Remove everthing from the end of string marker Chr(0)
     WindowsUserId = UCase(Left(Buffer, InStr(Buffer, Chr(0)) - 1))
End Function

Systemtag:System

See also

  • GetUserID