Download the LogOn 2000 Db from
http://www.access-programmers.co.uk/forums/showthread.php?t=64532
It has a module to get the user name:
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fGetOSUserName() As String
On Error GoTo fGetOSUserName_Err
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fGetOSUserName = Left$(strUserName, lngLen - 1)
Else
fGetOSUserName = ""
End If
fGetOSUserName_Exit:
Exit Function
fGetOSUserName_Err:
MsgBox Err.Description
Resume fGetOSUserName_Exit
End Function
Then refer to it on your form:
Me.txtUsername = fGetOSUserName
Dave