This is a section of Code that I got online that will get the Windows Username and/or computer name. Got it awhile ago and unfortunately don't remember exactly where. Hopefully another user here will recognize it and give the website. Once you've put this into Access you can call the functions from queries, Forms wherever you need them.
Code:
Option Compare Database
Option Explicit
Private Declare Function apiGetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetComputerName() As String
On Error Resume Next
Dim lngLen As Long, lngX As Long
Dim strCompName As String
lngLen = 16
strCompName = String$(lngLen, 0)
lngX = apiGetComputerName(strCompName, lngLen)
If lngX <> 0 Then
GetComputerName = Left$(strCompName, lngLen)
Else
GetComputerName = "Unknown"
End If
End Function
Public Function GetLoginName() As String
On Error Resume Next
Dim lngen As Long
Dim lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngen = 255
lngX = apiGetUserName(strUserName, lngen)
If lngX <> 0 Then
GetLoginName = Left$(strUserName, lngen - 1)
Else
GetLoginName = "Guest"
End If
End Function