Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get logged-in user's name in Access vba? [duplicate]

Tags:

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:

  • Is there a way for MS Access to grab the current Active Directory user?
  • Using VB6, how do I get the current user and domain on Windows XP?
  • How can I get the currently logged-in windows user in Access VBA?
  • Excel 2007 VBA and WMI - Current DOMAIN\USER
like image 524
Varun Mahajan Avatar asked Mar 24 '09 12:03

Varun Mahajan


People also ask

How to Get the Username in VBA?

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.

How do I see who is logged into my Access database?

Press CTRL+G to open the Immediate Window. Note that the Immediate window returns a list of users who are logged onto the database.


1 Answers

Try this:

Function UserNameWindows() As String      UserName = Environ("USERNAME") End Function 
like image 57
JoshJordan Avatar answered Sep 30 '22 04:09

JoshJordan