Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the number of users connected to an Access DB 1

Status
Not open for further replies.

NFLDUser

IS-IT--Management
Apr 17, 2006
47
CA
We are using an ADODB.Connection to an access database. Is there a way that I can grab the number of connections or current sessions to that database?

I have a compact/repair utility built into the software but I want to tell users what workstatations are still connected.

Thanks.
 
Code:
Public Const Jet_Schema_UserRoster = "{947bb102-5d43-11d1-bdbf-00c04fb92675}"
Public Cnn As ADODB.Connection

Sub GuessWho()
Dim S As String
Dim rstSchema As ADODB.Recordset
            
    Set rstSchema = Cnn.OpenSchema(adSchemaProviderSpecific, , Jet_Schema_UserRoster)
    Do Until rstSchema.EOF
        S = S & "Computer Name: " & Left(Trim(rstSchema.Fields(0)), Len(Trim(rstSchema.Fields(0))) - 1) & "     User: " & Left(Trim(rstSchema.Fields(1)), Len(Trim(rstSchema.Fields(1))) - 1) & Chr(10)
        rstSchema.MoveNext
    Loop
    rstSchema.Close
    Set rstSchema = Nothing
    If Len(S) = 0 Then S = "No user."
    MsgBox S, vbOKOnly, "Connected Users"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top