Function CountUsers(cn As ADODB.Connection)
Dim rs As ADODB.Recordset
' 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}")
CountUsers = 0
With rs
Do Until .EOF
CountUsers = CountUsers + 1
.MoveNext
Loop
End With
rs.Close
Set rs = Nothing
End Function
Sub test()
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
' Open the connection
With cn
.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\opssvr01\tpg_bo_data\EMTN\EMTN back end.mdb"
End With
MsgBox CountUsers(cn)
Set cn = Nothing
End Sub