Can I access the Windows User Logon Id

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Access application that was not designed to have the users login to
it. The users just open Access and then navigate to the application to open
it. I would like to be able to know who is in the application, so when I need
to work on it, I don't have to guess who to tell to exit the application. I
would like to know if I can add a process in the on open of the application
that can get the user's Window's logon ID and enter it into a table, and
remove from that table when they exit the application. Can this be done and
how difficult would it be?

Thanks in advance
Kenny A.
 
Kenny said:
Can this be done and
how difficult would it be?

It's not hard at all. You can get the code from here
http://www.mvps.org/access/api/api0008.htm to get the windows login, then run
an append query in the startup form's code that adds this login ID to the
table. When this startup form closes, it can open a hidden form which will
run a delete query to delete the record for this user when it closes (when
user exits the app). Alternatively, you can have your startup form call the
hidden form which does the record append when it opens and deletes the record
when it closes.
 
Try this link: http://www.mvps.org/access/modules/mdl0055.htm

it has a small access app that looks at the ldb file and will tell you
all of the users that are logged into mdb that you reference.


really neat and small, and the code for the form can be imported into
any app that you want or run standalone out of this app. With that you
may be able to tell what machine is actually holding open the ldb file
without having to try to guess.


A potential problem with the other method is if the user's machine
crashes or is dropped then the table is not accurate.

Ron
 
yes; if you used Access Data Projects it would be as simple as this:

Select SUSER_SNAME()

Access MDB is for mentally handicapped people
 

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

Back
Top