Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Tracking users

Tracking users

Tracking users


I am working on a way to track users who log in and out of 6 Access databases (front end) in different locations (network drives) into a table in an exclusive database with details (fields) such as ConnectionID; Username; User Computer name; database name; date/time logged in; date/time logged out.

I have placed an append query on the OnLoad property of the First form that opens in each database (which is never closes as long as the Access database front end is up and running). This First form is different in different database front ends i.e. it can be the welcome form or the menu form or a form displaying the title/name of the database). The append query inserts the ConnectionID (incremental based on previous maximum value); Username; User Computer name; database name; and date/time logged in.

I have placed an update query on the OnClose property of the first form. The update query updates the date/time logged out for the ConnectionID based on the user’s Username.

This setup is working as intended but I wanted to know if there was a function that can be used which would eliminate the need to place queries on the OnLoad and OnClose properties of the form.

I have found and functions for Username; User Computer name; and database name on the internet which are used as criteria for these fields in the queries but don’t know how I can achieve this process without using individual (first open) forms in different databases.

Thank you.

RE: Tracking users

A more generic startup way would be to run an autoezec macro (autoexec runs at startuo). Although only a form is going to give you a quit event.

It seems like what you really want is a common way of doing things. There is no reason you can't have two forms open in the background.

RE: Tracking users


As Iameid mentioned, you can use the autoexec macro to run your Update Query on log in, and if you've already got a menu for the users, add an Exit button to it. The Exit button could run a macro containing the Update Query to indicate the user has left the app. As long as the users use the button to exit the app, it works very well. I've had this running for the last 17 years and it works like a charm.

Hope this helps!

RE: Tracking users


Lameid and Meagain, thank you for your suggestions.

My main issue is with how the users close the Access database. Append query in the Autoexec works perfectly as there is pretty much only one way of opening the accdb file. I have exit command buttons on all the forms and have disabled the close (x) button on all of them. Ideally, most users use the exit button to close the database but quite a few close the database by clicking on the close button of the application (top right corner). When this is done, the update query fails to run and there is no log out time entry created.

I looked up disabling the application close button and found this solution online (http://www.fmsinc.com/microsoftaccess/startup/preventclose.asp) but the caveat in the solution warns that there is a possibility that users might not be able to close the database properly and "get stuck in an infinite loop or dead-end". It asks for creating proper error handling methods to avoid this situation but I am not sure what kinds of errors will be generated or not generated frustrating the users to go through the task manager to close the database.

Basically, I was looking for something like an Autoexec for closing of the database which would run the update query consistently and reliably regardless of how the user closes the accdb file. It would really help if there is a way to ensure the closing of the main/first form which initiates the update query can be forced to work with the closing of the accdb file.

Again thank you both for your help!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close