Yes, put it in a module (not a class module), and then continue with step 5
below.
All that module does, though, is write to the Immediate window (Ctrl-G).
You'll want to get it onto a form. What version of Access are you using?
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Chad" <(E-Mail Removed)> wrote in message
news:06EE283C-0246-414D-8F30-(E-Mail Removed)...
> Philip, Thats great but what do I do with the code? Do I put it in a
> module?
> If so How would I use it on my form? thanks!
> this is where I got my code (It got all jumbled up when pasted)
> http://support.microsoft.com/?id=285822
>
> Thanks,
> Chad
>
> "Philip" wrote:
>
>> You could try coding iut likes this (with line breaks):
>>
>> 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
>> Loop
>>
>> End Sub
>>
>> HTH
>>
>> Philip
>> "Chad" wrote:
>>
>> > 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.
>> >
>> >