Listing current users at startup on the autoex form

L

Leroy-P

As an administrator, I need to know who is logged into the data base at
openning screen, so I can notify they to exit, if the need arises?
How do I do this, would I use the CurrentUser() and do I do that?
Thanks
 
K

Keith Wilby

Leroy-P said:
As an administrator, I need to know who is logged into the data base at
openning screen, so I can notify they to exit, if the need arises?
How do I do this, would I use the CurrentUser() and do I do that?
Thanks

The CurrentUser function returns the name of the account currently logged on
to the database. You'd need to have invoked user-level security for it to
be of use You can use the Environ property to return the network user ID,
although this can be tweaked by savvy users. I use the Environ property
because, in my line of work, the risk of someone tampering with it is very
low.

Regards,
Keith.
www.keithwilby.com
 
R

Ray

Leroy,

What I do is use Notepad to open the .LDB file. It's simple. It's a fast way
of knowing who is logged in. And no programming involved.

When an .MDB file opens, MS Access temporarily creates an .LDB file in the
same folder as the MDB file. When everyone logs out, this file disappears.
What I do is open this .LDB file using Notepad and it gives me a list of who
is logged in. It's a crude way of doing it but hey, it suits my needs.

There are tools out there that do this for you, or you can program it if you
want, but this is faster.

Ray
 
L

Leroy-P

That seemed to be my answer, but when I tried to open the with; Wordpad,
error message said it was in use by another program or appication. The file
is locked.
Is there away to unlock the while it is in use?
 
G

Granny Spitz via AccessMonster.com

Ray said:
What I do is use Notepad to open the .LDB file. It's simple. It's a fast way
of knowing who is logged in. And no programming involved.

Hon, the downside to this shortcut is that the LDB file shows Susie's and
George's computers as logged into the application when, in fact, Susie's been
in the Bahamas on her honeymoon for the last few days and George hasn't been
back to work since the sporting accident at the company picnic last weekend.
The reason for this is that the LDB file is created and as each new user
opens the database file, his CurrentUser( ) name and computer name are added
to the LDB file. But as each user exits the database, his CurrentUser( )
name and computer name remain in the LDB file, because no records are ever
deleted from it. The records for people who have exited the database are
eventually overwritten when new users open the database and replace the
exited users' records, but if there aren't two additional new users to
overwrite Susie's and George's records, they'll be listed as already "in the
database" when they finally return to work. When the last user in the exits,
the LDB file will be deleted, but until then it may list a dozen or more
people in the database when there's actually only one.

If you want to know who *is* in the database, instead of who *was* in the
database, then you can read this Web page for some suggestions:

http://www.mvps.org/access/general/gen0034.htm
 
R

Ray

In my particular case everyone logs out at the end of the day so the LDB file
gets recreated every morning. When it gets recreated, the old names get
flushed out. So if someone is on vacation, his/her name won't appear the very
next day. In case someone exits the database the same day, for me at least,
that's still ok because I send out an email saying "If you're still using the
database, please log off"...Keep in mind this was my temporary solution, I
know it's not the best one, but it was a quick and temporary one. I only have
20 users so I pretty much know who is on vacation or who is in the database
when I use this method.
 
L

Leroy-P

Thanks for all the help, I could not open the file while others were still in
and I need to who is in, so I can work. The referenced site seems to be what
I need, but I haven't the time right now to verify. Rather than an email
message it would be nice to broadcast a message.
(http://www.mvps.org/access/general/gen0034.htm)

Again Thanks to all....
 
R

Ray Cacciatore

Try this:

The way I solved this issue with my database was to have my main menu form
(which is always opened in the background) check for a condition every 60
seconds. If the condition is true then the user sees a message popping up
saying "Please exit the database". I also made sure that after 5 minutes, the
application boots them off and automatically shuts down (because some people
may not be at their desk when the message pops up). I have a front end
application on each user's machine and a back-end database on a shared
folder. In the back-end I have a table with a Yes/No field called
"LockDatabase". This is the field that the main menu scans every minute.
Furthermore, I also added code so that users who attempt to start the
database after I lock it can't get in.

The reason this works for me is because I don't need to know who is in the
database, the application does all the work by logging everyone out.

Ray
 
L

Leroy-P

Unfortunly, I did not split my db when I first developed it and after reading
so much about how useful a split db is, at the next major upgrade I will
split mine and incorporate your ideas.

Thanks Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top