Unless the database is opened exclusively, the LDB file will tell
you who is connected. Sample code:
http://allenbrowne.com/func-ADO.html#ShowUserRosterMultipleUser
s
I have been working with the old msldbusr.dll for nearly a decade
now, and recently implemented the ADO UserRoster for the first time.
It seems to give different results, and seems to be getting data out
of the MDB file itself instead of just from the LDB file.
I just revived an old administrative database for the possible use
of one of my clients and you can download it here:
http://dfenton.com/DFA/download/Access/Admin.zip
It's an A2K database, and it uses late binding for ADO.
I did not need the complicated code you have, Allen, to get the
number of users.
I found that the msldbusr.dll code was much easier to work with (it
returns a much more versatile data structure), even though the
basics for UserRoster look really easy. The problem is that if you
want to filter the results you can't, because you don't have access
to the field names so you can query the UserRoster with WHERE
clauses. I found this to be a real lack.
Anyway, the above database has a UserRoster implementation in its
main "Who's logged on?" form, and also has two alternate approaches
that don't use UserRoster. One uses the old msldbusr.dll, which was
for Jet 3.5. But most of its functionality works just fine with Jet
4 (it can't do the suspect users lookup, though; or, at least, I
haven't figured out how to make it work). The other form just opens
the LDB file with basic I/O functions and eads it directly. This
doesn't give you as much information about the states, but can work
in some situations where msldbusr.dll will not.
Feedback and suggestions welcome -- it really was a very
quick-and-dirty conversion of code that I wrote in 1998! And it was
my first use of the ADO UserRoster.