Network user count question

From: sheryl (sheryl_at_cybermesa.com)
Date: 12/30/04


Date: Thu, 30 Dec 2004 13:31:11 -0700

Hello everyone,

What is the best method for keeping track of the number of users logged onto
an MS Access database on a network server? My application is sold for 1, 5
and 10 users, etc.; so I have to be sure there's never more users using the
software than what they've purchased.

My application has its own log on screen for internal security purposes, and
I am adding a new user when they log on, then deleting them when they log
off. What if there's a system failure, and the users are still "logged on"
when the applications starts again? That could potentially keep anyone from
logging on.

I thought about giving them a utility to clear out the users, but that could
obviously be abused. Then there's the SUSPECTED_STATE value in
Connection.OpenSchema that would tell me that the user didn't exit the
database normally. I just don't know how reliable that would be.

Thanks a bunch,
Sheryl

This is my code:

Public Function AddUser(mUserID As String, mPassword As String) As Boolean
    Dim bOK As Boolean
    bOK = True
    'check number of users logged on against allowable users
    'UsersLoggedOn subtracts 3 to account for users: admin, Creator and
Engine
    If Me.UsersLoggedOn >= Me.AllowableUsers Then
        CallBackObject.DBMaxUsers
        bOK = False
        GoTo CleanUp
    End If
    'make sure user isn't already logged on
    If Me.UserExists(mUserID) Then GoTo CleanUp
    'add user
    With cat
        .Users.Append mUserID, mPassword
        .Groups("Users").Users.Append mUserID
    End With
CleanUp:
    AddUser = bOK
End Function

Public Sub RemoveUser(mUserID As String, mPassword As String)
    Dim obj As User
    For Each obj In cat.Users
        With obj
            If Trim$(.Name) = Trim$(mUserID) Then
                cat.Users.Delete mUserID
                Exit For
            End If
        End With
    Next
CleanUp:
    Set obj = Nothing
End Sub



Relevant Pages

  • Re: Confused about using Reflection to examine a collection
    ... the precise type that Reflection is saying it is. ... say that 'obj' is actually a custom collection. ... If it were a basic type, such as 'string' then I would do a cast like this: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Send Message to filemaker 5.5 from windows form application
    ... Script created by Steve Carson and it was modified by Kristina ... ' Chrto represent double quotes if you are passing a string. ... Dim pHyperlink As IHyperlink ... 'opens Microsoft Access database ...
    (comp.databases.filemaker)
  • Re: Improving String.equals() implementation
    ... public boolean equals(Object obj) { ... In the case of comparing to an actual String, this should be quite fast - i don't think there's any per-execution overhead to setting up a try block. ... if (!this instanceof String) throw new ClassCastException; ... The real problem would be the overhead of allocating and throwing the exceptions - as you say, i don't think the compiler will optimise those away. ...
    (comp.lang.java.programmer)
  • Re: Update connect string in queries.
    ... Dim obj As DAO.QueryDef, dbs As DAO.Database ... Dim strConn As String, strDSN As String, strDescription As String ... Set dbs = CurrentDB ...
    (microsoft.public.access.modulesdaovba)
  • Re: ConvertReportToPDF (Lebans) und die Access 2003 Runtime ...
    ... Function OutputSnapshot(Reportname As String, _ ... Optional Autostart As Boolean) As Boolean ... Dim arrFormats As Variant ... Dim bOK As Boolean ...
    (microsoft.public.de.access)