Network user count question
From: sheryl (sheryl_at_cybermesa.com)
Date: 12/30/04
- Next message: Tim: "Data Report Designer and SHAPE command"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Tim: "Data Report Designer and SHAPE command"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|