J John Parker Jun 11, 2004 #1 On a secured database using workgroups, how can I access the name of the user that is logged on using VBA?
On a secured database using workgroups, how can I access the name of the user that is logged on using VBA?
B Bruce Jun 11, 2004 #2 I don't remember wher I got this: In the Declarations section of VBA-> Declare Function GetUserName Lib "ADVAPI32.DLL" Alias "GetUserNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long Then write the function: Function LogonUserName() Dim S As String Dim N As Long Dim Res As Long S = String$(200, 0) N = 199 Res = GetUserName(S, N) LogonUserName = Left(S, N - 1) End Function then: User_id = LogonUserName Returns the UserID of the current user..
I don't remember wher I got this: In the Declarations section of VBA-> Declare Function GetUserName Lib "ADVAPI32.DLL" Alias "GetUserNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long Then write the function: Function LogonUserName() Dim S As String Dim N As Long Dim Res As Long S = String$(200, 0) N = 199 Res = GetUserName(S, N) LogonUserName = Left(S, N - 1) End Function then: User_id = LogonUserName Returns the UserID of the current user..