Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2015
    Posts
    11

    How to creae username for people logged on to Access

    I have a small office with about 10 people sharing an access Database from a shared drive. I want to be able to assign them usernames, so that anyone "logged in" or has Database open, can tell who is logged in. Security is not an issue, so don't need passwords and such. Just want to be able to display on the screen who is logged in. Everyone logging in has same rights to view and edit, no one has exclusive rights to database. I am using Access 2013.



    Thanks in advance

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    run this in debug window , (no need to create user names, it uses their pc login)

    Code:
    Sub ShowUserRoster()
        Dim cn As New ADODB.Connection
        Dim rs As New ADODB.Recordset
        Dim i, j As Long
    
    
        Set cn = CurrentProject.Connection
    
    
        ' The user roster is exposed as a provider-specific schema rowset
        ' in the Jet 4.0 OLE DB provider.  You have to use a GUID to
        ' reference the schema, as provider-specific schemas are not
        ' listed in ADO's type library for schema rowsets
    
    
        Set rs = cn.OpenSchema(adSchemaProviderSpecific, , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
    
    
        'Output the list of all users in the current database.
        Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, "", rs.Fields(2).Name, rs.Fields(3).Name
    
    
        While Not rs.EOF
            Debug.Print rs.Fields(0), rs.Fields(1),  rs.Fields(2), rs.Fields(3)
            rs.MoveNext
        Wend
    End Sub

  3. #3
    ZeroWard is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    5
    Crazy question, could the individual user profile be used to populate a field when entering data?

    Such as if someone is adding a record, instead of manually adding their own name, it would populate based off of the user profile name?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    If by user profile you mean network profile and login, I would say yes.

    I am not familiar with the code posted by ranman but it certainly works.

    I use Environ("USERNAME") to capture network username. The Environ() function can retrieve other info as well. https://msdn.microsoft.com/en-us/lib...or=-2147217396
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 14
    Last Post: 08-17-2015, 02:32 AM
  2. Replies: 5
    Last Post: 08-08-2012, 01:28 PM
  3. restricting access until logged in
    By gbmarlysis in forum Security
    Replies: 1
    Last Post: 02-17-2012, 06:43 PM
  4. List of people logged to Access 2007
    By chrisisishere in forum Security
    Replies: 2
    Last Post: 10-23-2011, 05:16 AM
  5. Replies: 0
    Last Post: 12-28-2009, 12:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums