Access/VBA Library

GetUserID

API : Retrieves the Windows userid of the current user

Syntax

GetUserID( Buffer, bufferSize )
Parameters
Name Type Description
Buffer String Required. Buffer to store the userid.
bufferSize Long Required. The maximum length of the buffer.
Return value

Long : If successfull the number of characters copied to buffer, otherwise zero.

Code
Declare Function GetUserID Lib "advapi32.dll" _
        Alias "GetUserNameA" _
        (ByVal Buffer As String, _
         bufferSize As Long) As Long

Remarks

  • For Windows 64-bit add the PtrSafe keyword.

See also

  • GetWindowsUserId