Public Function ADOShowNumberOfUsers(cnnConnection As ADODB.Connection) As Integer
' Comments: Uses the new Jet 4 User Roster to list all users in the specified database
' Params : cnnConnection Open ADODB connection to the Jet Database
' Returns : String of all users seperated by a new line
' Source : Total Visual SourceBook
Dim rstTmp As New ADODB.Recordset
Dim strTmp As String
' This is the value to pass to Jet to get the user roster back.
Const cstrJetUserRosterGUID As String = "{947bb102-5d43-11d1-bdbf-00c04fb92675}"
On Error GoTo PROC_ERR
' Jet exposes the user roster as a provider-specific schema rowset.
' To get Jet to return this, we open a recordset and pass the special GUID value.
Set rstTmp = cnnConnection.OpenSchema(adSchemaProviderSpecific, , cstrJetUserRosterGUID)
ADOShowNumberOfUsers = rstTmp.RecordCount
rstTmp.Close
PROC_EXIT:
Exit Function
PROC_ERR:
MsgBox "Error: " & Err.Number & ". " & Err.Description, , "ADOShowUserRosterToString"
Resume PROC_EXIT
End Function