How to get a current user from a custom login form (1 Viewer)

yameen2011

Registered User.
Local time
Today, 14:52
Joined
Jan 19, 2013
Messages
59
Hi friends, can some one like to tell me that how i can get a current user from a custom login form CurrentUser() this function always return a system user name admin as default. In my login schema i have a Hidden splash form that have a unbound field that holds user name from custom login form after login a dashboard execute and also display user name on dashboard according to user login ,this working fine for mine. Actually i want to make a currentuser stamp in every entry when a record is entered in database. i have no idea to perform this can any one tell me about this.
Thanks in advance.
 

Royce

Access Developer
Local time
Today, 05:52
Joined
Nov 8, 2012
Messages
99
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal IpBuffer As String, nSize As Long) As Long

Function WindowsUserName() As String
Dim LngBufLen As Long
Dim strUser As String

strUser = String$(15, " ")
LngBufLen = 15

If GetUserName(strUser, LngBufLen) = 1 Then
WindowsUserName = Left(strUser, LngBufLen - 1)
Else
WindowsUserName = "Unknown"
End If
End Function
 

madEG

Registered User.
Local time
Today, 06:52
Joined
Jan 26, 2007
Messages
309
Oddly this doesn't work when the username has an underscore in the string.

Does anyone understand why? I'll admit... I don't.

It returns blank.
 

Users who are viewing this thread

Top Bottom