G
Guest
Hello, I have a main form and want to show who is currently loged into the
database on this form. I have found some Module code on microsoft help but I
dont know how to get it to show on my form? Is there some easy way to get
this to work? Thanks!!
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
5 .Save the module as ShowUsers.
6. Press CTRL+G to open the Immediate Window.
7. Type the following line in the Immediate window, and then press ENTER:
ShowUserRosterMultipleUsers
Note that the Immediate window returns a list of users who are logged onto
the database.
database on this form. I have found some Module code on microsoft help but I
dont know how to get it to show on my form? Is there some easy way to get
this to work? Thanks!!
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
5 .Save the module as ShowUsers.
6. Press CTRL+G to open the Immediate Window.
7. Type the following line in the Immediate window, and then press ENTER:
ShowUserRosterMultipleUsers
Note that the Immediate window returns a list of users who are logged onto
the database.