Number of users

SlepyJack

New member
Local time
Today, 04:55
Joined
Oct 21, 2004
Messages
6
How can I get number of users (by VB code) which have curently open my database (database.mdb).

(But not by reading *.ldb file.)

I want not allow to user open (or changing data) database, if five users have the database open.

Thanks :cool:
 
Try adding the following to a standard module:

Public Function CountUsers() As Short
Dim wrk As DAO.Workspace

Set wrk = DBEngine(0)

CountUsers = wrk.Users.Count
End Function

From your code you can now get the number of users simply by calling the function above as follows:

If CountUsers() >5 Then ...

Hope this is correct and helps.
 

Users who are viewing this thread

Back
Top Bottom