I want to get the name of user who have logged-in ,in the access vba. What is the best way to get it
Duplicates of this question:
I want to get the name of user who have logged-in ,in the access vba. What is the best way to get it
Duplicates of this question:
Try this:
Function UserNameWindows() As String
UserName = Environ("USERNAME")
End Function
Public Declare Function GetUserName Lib "advapi32.dll"
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
....
Dim strLen As Long
Dim strtmp As String * 256
Dim strUserName As String
strLen = 255
GetUserName strtmp, strLen
strUserName = Trim$(TrimNull(strtmp))
Turns out question has been asked before: http://stackoverflow.com/questions/168659/how-can-i-get-the-currently-logged-in-windows-user-in-access-vba/168682