S
Stephen
I found the code below in one of my seaches and need some help please. The
code does what I want for, the most part. But what I want, and just can't
figure out, is;
#1. to have the 'comupter name' the code provides, input to a Table instead
of the Immediate Window and without having to type anything special to run
the code.
#2. so, I want to be able to click on my created button for the code to
activate, inputing the results into my table..
#3. I want to be able to use the code from a separate database or at least
activate it from a separate DB.
Your help is greatly appreciated! The code is listed below...
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
Save the module as ShowUsers.
Press CTRL+G to open the Immediate Window.
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.
code does what I want for, the most part. But what I want, and just can't
figure out, is;
#1. to have the 'comupter name' the code provides, input to a Table instead
of the Immediate Window and without having to type anything special to run
the code.
#2. so, I want to be able to click on my created button for the code to
activate, inputing the results into my table..
#3. I want to be able to use the code from a separate database or at least
activate it from a separate DB.
Your help is greatly appreciated! The code is listed below...
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
Save the module as ShowUsers.
Press CTRL+G to open the Immediate Window.
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.