http://mvps.org/access/api/api0008.htm
API: Get Network UserName

Signature
HTH,
George
> Hi,
> What code do I write when I want to view the current user name?
> Because I made my one log-in form and I want that if the user doesn't put
> the correct password then my msg box should show the user name (I mean
> user
> name form the computer not form access
Paste this code into a standard module:
Private Declare Function GetUserNameA Lib "Advapi32" (ByVal strN As String,
ByRef intN As Long) As Long
Public Function GetUserID()
Dim Buffer As String * 20
Dim Length As Long
Dim lngresult As Long, userid As String
Length = 20
lngresult = GetUserNameA(Buffer, Length)
If lngresult <> 0 Then
userid = Left(Buffer, Length - 1)
Else
userid = "xxxxxxx"
End If
GetUserID = UCase(userid)
End Function
Then to get the user id
Me.txtUserID = GetUserID

Signature
Dave Hargis, Microsoft Access MVP
> Hi,
> What code do I write when I want to view the current user name?
> Because I made my one log-in form and I want that if the user doesn’t put
> the correct password then my msg box should show the user name (I mean user
> name form the computer not form access
Jone - 28 Dec 2007 03:06 GMT
Thanks!
> Paste this code into a standard module:
>
[quoted text clipped - 27 lines]
> > the correct password then my msg box should show the user name (I mean user
> > name form the computer not form access