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:
- 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
- and the list goes on
From stackoverflow
-
Try this:
Function UserNameWindows() As String UserName = Environ("USERNAME") End FunctionMitch Wheat : Bear in mind that this can be changed by users/applications... -
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
Varun Mahajan : I didn't see that the question has been asked before. Thanks, anyways
0 comments:
Post a Comment