ShowUsers on another Database (1 Viewer)

VzqCrs

Member
Local time
Yesterday, 21:13
Joined
Nov 15, 2021
Messages
54
Hello,

I found the following code on Microsoft and applied it to my BackEnd which obviously only had the Admin logged, which is me. I would like to alter this code to check if someone is in another Database - such as the accde. I would like to find out who is in the database so I can reach out directly and have them log off.

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

Set cn = CurrentProject.Connection 'THIS IS THE LINE I WOULD NEED TO CHANGE - ANY THOUGHTS?'

' 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





ReplyForward







 

isladogs

MVP / VIP
Local time
Today, 02:13
Joined
Jan 14, 2017
Messages
18,209
See my example app:
 

Users who are viewing this thread

Top Bottom