DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Russ Guest

    Access 97 list of current users


    I have developed an Access 97 database that is on my company's network. How
    do I get a list of all users (I'm assuming more than one at a time) who are
    currently logged in to the database?

    This is useful, because I might want to notify all the users to shut down
    temporarily so that I can do maintainence, for example.

    Any help would definitely be appreciated. Thanks,

    Russ

  2. #2
    Douglas J. Steele Guest

    Re: Access 97 list of current users

    Go to http://www.mvps.org/access/resources/utils.htm at Dev Ashish's "The
    Access Web", and download Microsoft's JETUTILS.EXE

    That has a DLL in it that lets you read the LDB file, which is where that
    information is stored.

    HTH

    --

    Doug Steele, Microsoft Access MVP
    Beer, Wine and Database Programming. What could be better?
    Visit "Doug Steele's Beer and Programming Emporium"
    http://I.Am/DougSteele/


    Russ <rreimann@earthlink.net> wrote in message
    news:399b573c$1@news.devx.com...
    >
    > I have developed an Access 97 database that is on my company's network.

    How
    > do I get a list of all users (I'm assuming more than one at a time) who

    are
    > currently logged in to the database?
    >
    > This is useful, because I might want to notify all the users to shut down
    > temporarily so that I can do maintainence, for example.
    >
    > Any help would definitely be appreciated. Thanks,
    >
    > Russ




  3. #3
    Russ Thompson Guest

    Re: Access 97 list of current users


    "Russ" <rreimann@earthlink.net> wrote:
    >
    >I have developed an Access 97 database that is on my company's network.

    How
    >do I get a list of all users (I'm assuming more than one at a time) who

    are
    >currently logged in to the database?
    >
    >This is useful, because I might want to notify all the users to shut down
    >temporarily so that I can do maintainence, for example.
    >
    >Any help would definitely be appreciated. Thanks,
    >
    >Russ



    Russ,
    You can use OpenSchema to do this.

    First, here is a list of Jet OLE DB Constants. Place these in a standard
    module in you app. The one you really need for this is JET_SCHEMA_USERROSTER.

    http://msdn.microsoft.com/library/ps...k/migr42n7.htm

    Next..
    Below is an example that came off of MSDN. Although, in the example, the
    recordset and the connection objects were not closed, and for some reason,
    there is a second connection object that is not even used for anything, so
    I made some small changes. It is setup so you can pass in the path to the
    database.

    call ShowUserRosterMultipleUsers("C:\MyDBPath\MyDB.mdb")

    Here is a link to the actual example:

    http://support.microsoft.com/support.../Q198/7/55.ASP

    HTH,
    -Russ Thompson.

    '*************************************************************
    Private Sub ShowUserRosterMultipleUsers(sDBPath As String)
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim i, j As Long

    Set cn = New ADODB.Connection
    cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & sDBPath & ";"

    '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, , JET_SCHEMA_USERROSTER)

    '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

    rs.Close
    Set rs = Nothing

    cn.Close
    Set cn = Nothing

    End Sub








  4. #4
    Russ Guest

    Re: Access 97 list of current users


    Thanks Mr. Thompson! Much appreciated.


    "Russ Thompson" <russell.thompson@adlink.com> wrote:
    >
    >"Russ" <rreimann@earthlink.net> wrote:
    >>
    >>I have developed an Access 97 database that is on my company's network.

    > How
    >>do I get a list of all users (I'm assuming more than one at a time) who

    >are
    >>currently logged in to the database?
    >>
    >>This is useful, because I might want to notify all the users to shut down
    >>temporarily so that I can do maintainence, for example.
    >>
    >>Any help would definitely be appreciated. Thanks,
    >>
    >>Russ

    >
    >
    >Russ,
    >You can use OpenSchema to do this.
    >
    >First, here is a list of Jet OLE DB Constants. Place these in a standard
    >module in you app. The one you really need for this is JET_SCHEMA_USERROSTER.
    >
    > http://msdn.microsoft.com/library/ps...k/migr42n7.htm
    >
    >Next..
    >Below is an example that came off of MSDN. Although, in the example, the
    >recordset and the connection objects were not closed, and for some reason,
    >there is a second connection object that is not even used for anything,

    so
    >I made some small changes. It is setup so you can pass in the path to the
    >database.
    >
    > call ShowUserRosterMultipleUsers("C:\MyDBPath\MyDB.mdb")
    >
    >Here is a link to the actual example:
    >
    > http://support.microsoft.com/support.../Q198/7/55.ASP
    >
    >HTH,
    >-Russ Thompson.
    >
    >'*************************************************************
    >Private Sub ShowUserRosterMultipleUsers(sDBPath As String)
    > Dim cn As ADODB.Connection
    > Dim rs As ADODB.Recordset
    > Dim i, j As Long
    >
    > Set cn = New ADODB.Connection
    > cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
    > "Data Source=" & sDBPath & ";"
    >
    > '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, , JET_SCHEMA_USERROSTER)
    >
    > '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
    >
    > rs.Close
    > Set rs = Nothing
    >
    > cn.Close
    > Set cn = Nothing
    >
    >End Sub
    >
    >
    >
    >
    >
    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links