How to show the logged in users in input form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • irslan rafique
    New Member
    • Oct 2014
    • 40

    #1

    How to show the logged in users in input form

    Hi I have an Input form based on query.
    I have 4 users and 2 administrator. I want to show the name of data entry operator with each entry OR want to display the name of logged in users in input form.

    Please assist me.

    Thanks
  • dsatino
    Contributor
    • May 2010
    • 393

    #2
    paste this into a module and call the function when you need it.



    Code:
    Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    
    Public Function fOSUserName() As String 'Returns the network login name
        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
            fOSUserName = left$(strUserName, lngLen - 1)
        Else
            fOSUserName = vbNullString
        End If
    End Function
    Last edited by Rabbit; Oct 24 '14, 07:12 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.

    Comment

    • irslan rafique
      New Member
      • Oct 2014
      • 40

      #3
      Hi,
      It will capture the Network Users...But I want to display the users created in a table of database. I created a login form and users can login by putting user names and password saved in tbluser.
      Please advice

      Comment

      • twinnyfo
        Recognized Expert Moderator Specialist
        • Nov 2011
        • 3665

        #4
        You may want to look at this article on User Permissions and Custom Menus. It may be a bit more involved than what you are initially looking for, but you should be able to pick and choose certain parts that should work for you.

        Standing by to assist if you need anything else.

        Comment

        Working...