I have a Frontend/backend system. The frontend resides in the users
C: drive and the Backend Data is on a server share folder.
Is the way I can limit the number of online (active) users to say 5???
Phil
Phil,
One way would be to use a single field, single record table in the BE to
hold the current number of users, and some simple code (or even update
queries fired by macros) behind the Open and Close events of a switchboard
in the front end (or even a dummy, hidden form just for the purpose, in lack
of a switchboard) to increase / decrease the number of users by 1 as they
log in and out. Not a very robust method, though, especially in that a
frozen FE will fail to update the BE of logging off, or "smart" users might
manually change the count in the BE to get in when they shouldn't etc.
Another way is to check for the existence of a lock file for the BE, and if
one is found, count the number of users in it. Obviously checking for the
existence only makes sense if the check is run outside of the FE (in another
.mdb or .exe), or if connection to the back end is done programatically
after the FE is loaded. This simple piece of code will do just that:
Sub count_users()
lockfile = "SomeDrive:\SomeFolder\Somefile.ldb"
If Dir(lockfile) = "" Then
'no current user
'
Exit Sub
End If
Open lockfile For Input As #1
Line Input #1, usr
Close #1
cnt = 1
lusr = Len(usr)
For i = 2 To 186
If Mid(usr, i - 1, 1) = " " And Mid(usr, i, 1) <> " " Then cnt = cnt + 1
Next
usrcount = cnt / 2
Debug.Print usrcount
End Sub
and it will work just as fine in a VB 6.0 exe as it will in Access.
HTH,
Nikos
> I have a Frontend/backend system. The frontend resides in the users
> C: drive and the Backend Data is on a server share folder.
>
> Is the way I can limit the number of online (active) users to say 5???
>
> Phil