Determine who is logged on to an Access 2010 database

Posted on 2014-10-02
Last Modified: 2014-10-09
The following code is supposed to determine what users are logged on to an Access DB.  It was received from  I created a module named ShowUsers as instructed, and am using Microsoft ActiveX Data Objects 6.1 Library.  The code compiles but when I open the Immediate window, type ShowUserRosterMultipleUsers and press enter, nothing happens.  I also closed and reopened the file to try again but nothing changed.  I'm using Access 2010 in a Citrix environment and don't know if that impacts what is supposed to happen.

Sub ShowUserRosterMultipleUsers()
    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)

End Sub

Currently I'm the only user logged into the file so would expect my user ID to appear.  Please advise if I must do something else to make this process work.
Question by:Liberty4all
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +1
LVL 75
ID: 40357737
Not sure what is going on, but keep in mind this is only going to (mainly) return the Computer Name(s) of any users connected.  It does not return the Windows user name or any 'real name'

Also, I'm not sure ... that code works on the ACCDB format ?
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40357794
The code worked for me in a accdb...
FWIW, I was using the Active x 2.1 library, ...not the 6.1 you are using....

LVL 75
ID: 40357804
Hey Jeff ... MIA bro.

Guess that clears up the ACCDB concern.

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40357811
taking this year off...

Author Comment

ID: 40357834
Since I need to use the ActiveX Data Objects 6.1 Library and ActiveX Data Objects Recordset 6.0 Library should I conclude it's not possible to make this work in my situation?

I will look at the link at UtterAccess to see if that helps.
LVL 75
ID: 40357851
"I will look at the link at UtterAccess to see if that helps."
That utility definitely works.  In fact, coincidentally ... I am - as we speak - modifying it for special needs I have here at work.

@ Pat ... that link will probably get deleted by the mods ....
LVL 38

Expert Comment

ID: 40357864
Better use it quickly then:)

Author Comment

ID: 40371004
Pat, the link to the article on was removed before I could copy it.  Can you please repost it?  If doing so is against Experts Exchange policy please advise and I will close my question.
LVL 75
ID: 40371126
EE does  not allow links to competitive sites.
LVL 38

Accepted Solution

PatHartman earned 500 total points
ID: 40371266
I will send the link to you personally.
LVL 75
ID: 40371361
Umm ... Pat ... you have to keep the discussion within EE ... :-)

Author Closing Comment

ID: 40371464
I have not tested the solution but if I need help with it will pursue that in another forum.
LVL 38

Expert Comment

ID: 40371500
We are not discussing anything.  I don't understand why you are so determined to keep me from telling Liberty4all where to find the tool he needs.  If you don't want people to talk privately, remove the private messaging feature!!!!

People pay for a subscription to this forum because there are a number of people who provide excellent answers, quickly.  With the free forums, the response time is almost always greater and the answers are not as good.

You really don't need to be afraid of the competition.
LVL 75
ID: 40371509
It's not me :-)
Mods monitor these questions and frown on anything to do with direct competitive sites.
LVL 38

Expert Comment

ID: 40371755
Thanks Jim.  But, what is your suggestion for this situation?  Do you want content copied here where it is disconnected from its source and will almost certainly become outdated?
LVL 75
ID: 40371845
I'm pretty sure Brent (Spaulding aka datadrenaline) would have no problem with someone uploading the Who Is Connected db here.  His copyrights are contained within the db ... basically free to use as long a copyright remains intact.
I'm currently created an A2013 version of it with a Ribbon and so on - some additional enhancements - and will then give to him - as a ... .surprise :-)

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question