Hi
I am trying to get some code working as described on the Microsoft KB 285822 in order to identify recent Access 2003 users. ( Source: )
I want to identify which users have been recently connected to the database, even if they are now disconnected, as well as their status - in Microsoft's words: whether or not the user connection was terminated under normal circumstances.
This should be possible (see below) but the problem is all I get returned is a list of users that are CURRENTLY connected...
The LDB file contains a list of all recent users including the ones that have disconnected - this can be seen through notepad. But you cannot see their status this way.
Microsoft show that Access 2003 can use the Jet UserRoster feature for this purpose and confirm that the following information is returned: (quote) Whether or not the user is currently connected to the database. (A user's ID remains in the lock database until the last user disconnects or until the slot is reclaimed for a new user connection.)
Microsoft's example code is as follows:
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)
rs.MoveNext
Wend
End Sub
If anyone has been able to get the status of the users that have disconnected please let me know. All help gratefully received.
Thanks in advance![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I am trying to get some code working as described on the Microsoft KB 285822 in order to identify recent Access 2003 users. ( Source: )
I want to identify which users have been recently connected to the database, even if they are now disconnected, as well as their status - in Microsoft's words: whether or not the user connection was terminated under normal circumstances.
This should be possible (see below) but the problem is all I get returned is a list of users that are CURRENTLY connected...
The LDB file contains a list of all recent users including the ones that have disconnected - this can be seen through notepad. But you cannot see their status this way.
Microsoft show that Access 2003 can use the Jet UserRoster feature for this purpose and confirm that the following information is returned: (quote) Whether or not the user is currently connected to the database. (A user's ID remains in the lock database until the last user disconnects or until the slot is reclaimed for a new user connection.)
Microsoft's example code is as follows:
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)
rs.MoveNext
Wend
End Sub
If anyone has been able to get the status of the users that have disconnected please let me know. All help gratefully received.
Thanks in advance