Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2007

Tip: Looking for answers? Try searching our database.

determine who is logged onto a database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chad - 31 May 2007 05:12 GMT
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.
Philip - 31 May 2007 10:51 GMT
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

> 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
[quoted text clipped - 19 lines]
> Note that the Immediate window returns a list of users who are logged onto
> the database.
Chad - 31 May 2007 13:02 GMT
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

> You could try coding iut likes this (with line breaks):
>
[quoted text clipped - 52 lines]
> > Note that the Immediate window returns a list of users who are logged onto
> > the database.
Douglas J. Steele - 31 May 2007 13:07 GMT
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?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Philip, Thats great but what do I do with the code? Do I put it in a
> module?
[quoted text clipped - 73 lines]
>> > onto
>> > the database.
Chad - 31 May 2007 21:55 GMT
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...

> Yes, put it in a module (not a class module), and then continue with step 5
> below.
[quoted text clipped - 79 lines]
> >> > onto
> >> > the database.
Philip - 31 May 2007 13:12 GMT
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

> 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!
[quoted text clipped - 60 lines]
> > > Note that the Immediate window returns a list of users who are logged onto
> > > the database.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.