Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 626
- Office Version
- 365
- 2010
- Platform
- Windows
I am still learning Access. I used to used a Excel as a database but I was told that Access is a database. So I designed a form, and on that form I have two textboxes 1st textbox is labeled LastModified and the second one is labeled ModifiedBy. When I login into my work computer, I have to enter my employeeID and password. So I know in Excel VBA in the Immediate window section, when I type in the following code
and hit return, it actually displays my name (first and last). However, this code does not work in Access. So when I web searched this issue, it stated that I should use the following code to retrieve the username
But this code only displays my employeeID, which is what I used to login with. How is it that Excel can pull the correct information and Access can't? Thank you.
VBA Code:
?application.username
VBA Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Me.ModifiedByUser = Environ$("username")
End If
End Sub