Suggestions on how to see active users for a ACCDE database? (1 Viewer)

gojets1721

Registered User.
Local time
Yesterday, 16:36
Joined
Jun 11, 2019
Messages
430
I use the code cited below to get a listing of active users who have a DB open. It follows this Microsoft guide.

However, this only works for an .ACCDB database. It doesn't work for a .ACCDE. Any suggestions on how to see active users within a ACCDE database?

Code:
Sub ShowUserRosterMultipleUsers()
    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset

    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
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:36
Joined
Oct 29, 2018
Messages
21,474
Do you mean it doesn't work because of the Debug.Print? Have you tried outputting the info into a message box or a file?

Edit. I guess you have tried that already.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:36
Joined
Oct 29, 2018
Messages
21,474
Seeing as you have already tried using a MsgBox, I just created a ACCDE to give it a shot. It worked for me.
 

gojets1721

Registered User.
Local time
Yesterday, 16:36
Joined
Jun 11, 2019
Messages
430
Seeing as you have already tried using a MsgBox, I just created a ACCDE to give it a shot. It worked for me.
Any time I try to open the module, it gives me an error stating "You can't import, export, create, modify, or rename any forms, reports, pages or modules in an ACCDe, MDE or ADE database"
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:36
Joined
Oct 29, 2018
Messages
21,474
Any time I try to open the module, it gives me an error stating "You can't import, export, create, modify, or rename any forms, reports, pages or modules in an ACCDe, MDE or ADE database"
Of course, that is true. You can't make changes or even view the code once you make a ACCDE. The normal practice is to do all your development in a ACCDB and then create a ACCDE to distribute to your users. If you need to make any changes to your app, design or code, then you do it in the ACCDB and the make a new ACCDE from it.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:36
Joined
Feb 19, 2002
Messages
43,293
I'm confused. The FE should NEVER, EVER be shared. Only the BE is shared. So, that code is intended to be used to view the users who have the BE open.

If you have multiple users opening the same physical copy of the FE, it's time to change that. Every user should have his own version of the FE on his local PC. If you are using RDP or Citrix, then each user would have the FE copied into his personal Folder, either when he logs in or when he opens the shortcut.

If you don't know how to distribute the FE correctly, we can help you.
 

Users who are viewing this thread

Top Bottom