Hi Bob,
I use the the modual below.
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Declare Function clt_OpenClipboard Lib "User32" Alias "OpenClipboard" (ByVal hwnd As Long) As Long
Declare Function clt_EmptyClipBoard Lib "User32" Alias "EmptyClipboard" () As Long
Declare Function clt_CloseClipboard Lib "User32" Alias "CloseClipboard" () As Long
Then I use the below code so that I can call it in VBA.
Public Property Get UserName() As Variant
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
UserName = Left$(sBuffer, lSize - 1)
End Property
This allowes me to pull a users ID by calling UserName() in the VBA code. This has always worked for me, but I now have a user that is not matching what I have listed for her network ID, do the database is denying her access as I block anyone who's ID is not in the auth table.