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:
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:
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: How can I get the currently logged-in windows user in Access VBA?
In a Form, Create a text box, with in text box properties select data tab
Default value =CurrentUser()
Current source "select table field name"
It will display current user log on name in text box / label as well as saves the user name in the table field