Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 11:41 AM
Jozef
Guest
 
Posts: n/a
Default How to tell if others are connected to the database

Hello,

I'm trying to find a way to see who or how many connections, (or both) are
open on a single access database.

What I'm trying to do is find out who is logged in and hopefully
automatically send them a message if they are needed out of hte database, or
at least so I know who to talk to if there is a connection to the database.

If there isn't a way to find out who, then at least if I can find out how
many, I won't get so aggrevated when I find a user in the database, shut
them down, go back to my desk only to find another user is connected...etc.

Any help would be appreciated.

Thanks!
Jo


  #2  
Old November 13th, 2005, 11:41 AM
Allen Browne
Guest
 
Posts: n/a
Default Re: How to tell if others are connected to the database

Assuming Access 2000 or later, take a look at:
http://support.microsoft.com/?id=198755

Example:

Function ShowUserRosterMultipleUsers()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long

cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=C:\Northwind2003.mdb"

' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4 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 Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jozef" <NOSPAM@NOSPAM.com> wrote in message
news:MeNpe.1606504$8l.792687@pd7tw1no...[color=blue]
>
> I'm trying to find a way to see who or how many connections, (or both)
> are open on a single access database.
>
> What I'm trying to do is find out who is logged in and hopefully
> automatically send them a message if they are needed out of hte database,
> or at least so I know who to talk to if there is a connection to the
> database.
>
> If there isn't a way to find out who, then at least if I can find out how
> many, I won't get so aggrevated when I find a user in the database, shut
> them down, go back to my desk only to find another user is
> connected...etc.
>
> Any help would be appreciated.
>
> Thanks!
> Jo[/color]


  #3  
Old November 13th, 2005, 11:42 AM
Jozef
Guest
 
Posts: n/a
Default Re: How to tell if others are connected to the database

Thanks Allen!

That should help out alot.


"Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
news:42a7a442$0$13550$5a62ac22@per-qv1-newsreader-01.iinet.net.au...[color=blue]
> Assuming Access 2000 or later, take a look at:
> http://support.microsoft.com/?id=198755
>
> Example:
>
> Function ShowUserRosterMultipleUsers()
> Dim cn As New ADODB.Connection
> Dim rs As New ADODB.Recordset
> Dim i, j As Long
>
> cn.Provider = "Microsoft.Jet.OLEDB.4.0"
> cn.Open "Data Source=C:\Northwind2003.mdb"
>
> ' The user roster is exposed as a provider-specific schema rowset
> ' in the Jet 4 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 Function
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Jozef" <NOSPAM@NOSPAM.com> wrote in message
> news:MeNpe.1606504$8l.792687@pd7tw1no...[color=green]
>>
>> I'm trying to find a way to see who or how many connections, (or both)
>> are open on a single access database.
>>
>> What I'm trying to do is find out who is logged in and hopefully
>> automatically send them a message if they are needed out of hte database,
>> or at least so I know who to talk to if there is a connection to the
>> database.
>>
>> If there isn't a way to find out who, then at least if I can find out how
>> many, I won't get so aggrevated when I find a user in the database, shut
>> them down, go back to my desk only to find another user is
>> connected...etc.
>>
>> Any help would be appreciated.
>>
>> Thanks!
>> Jo[/color]
>
>[/color]


 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles