PC Review


Reply
Thread Tools Rate Thread

determine who is logged onto a database

 
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      31st May 2007
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.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGhpbGlw?=
Guest
Posts: n/a
 
      31st May 2007
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.
>
>

 
Reply With Quote
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      31st May 2007
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.
> >
> >

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      31st May 2007
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.
>> >
>> >



 
Reply With Quote
 
=?Utf-8?B?UGhpbGlw?=
Guest
Posts: n/a
 
      31st May 2007
You would put it in a code module as a Function.

Then to use it on a form, in the Event Builder you choose 'Build Event' and
from the event handler you call your function.

Alternatively, you can use it in the events of the form...

HTH

Philip

"Chad" wrote:

> 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.
> > >
> > >

 
Reply With Quote
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      31st May 2007

In new to this so im sorry I should have posted in new users! I made a new
module called ShowUsers now what? Im using access 2000 at work and 2003 to do
the touch ups at home...


"Douglas J. Steele" wrote:

> 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.
> >> >
> >> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine users currently logged in Benedictum Microsoft ASP .NET 2 17th Apr 2008 12:08 AM
How to determine if anyone is logged on? =?Utf-8?B?VFggVGVjaGll?= Windows XP Security 0 13th Feb 2007 07:02 PM
Determine if user is still logged in to database... =?Utf-8?B?TWFydHkgQ3J1aXNl?= Microsoft VB .NET 0 23rd Nov 2004 11:57 PM
how to determine logged on user? djc Microsoft ADO .NET 7 15th Nov 2004 02:19 PM
How to determine who is logged in Tim Sanders Microsoft Windows 2000 Active Directory 5 17th Dec 2003 04:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:54 PM.