Possible Duplicate:
Is there a way for MS Access to grab the current Active Directory user?
I want to get the name of the logged-in User via vba in access. What is the best way to do this?
Duplicates of this question:
You can make a Windows API (application programming interface) call to a Microsoft Windows DLL (dynamic-link library) to get the current user name. The current user name can be obtained by using the GetUserNameA function in ADVAPI32. DLL.
Press CTRL+G to open the Immediate Window. Note that the Immediate window returns a list of users who are logged onto the database.
Try this:
Function UserNameWindows() As String UserName = Environ("USERNAME") End Function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With