Jon Watson is the founder of Biomation Systems, Inc. With 26 years experience helping Fortune 500 companies with process improvement he formed BioMation to bring the same expertise to smaller companies that need the same improvements at an affordable price.
At times you will find it very handy to know what a user was doing in your application at a specific time. This is especially useful with multi-user database applications for debugging or security reasons. With this tool implemented in your applications you will be able to see what event happened and at what time.
Here's the tip:
You are going to use a table and this simple set of code to record all the users transactions that you want to track. There are three simple steps to set this up in any application you develop. Create a table to hold the data, create a quick module, then add two lines of code to each operation you want to track such as a Form_Open or Form_Close event. That's it and you will find the information very useful.
Follow these simple steps and you will have a history of activity in your applications. Step one and two only have to be done once. Step 3 is needed for every event you want to track.
First create a simple table as described below:
1] Create a table to hold the user log information and name it USysLog.
Add these fields
Event as Text
EvTime as date/time
Save the table and name it USysLog and click No when asked to create a Key field
2] Create a module and add the following code. You can just cut and paste the following lines into a new module and save it using any name like LogMod.
'cut here
'Dimension a public variable at the top of the module.
Public LogEvent As String
'Next add this code in the module
Public LogEvent As String
Public Function LogEvt()
Dim SQL As String
SQL = "INSERT INTO UsysLog ( Event, EvTime ) SELECT '" & LogEvent & "' AS x1, #" & Now() & "# as x2;"
DoCmd.RunSQL SQL
End Function
'cut here
Close the module and save it as LogMod. (Name not important)
3] Next add these two lines of code to each event that you want to record a time for and edit the first line for the appropriate form name and event. In this example, you would see the text "Logon Opened" and an associated time in the UsysLog table.
LogEvent = " Logon Opened "
LogEvt
If you want to log a form opened time then put these lines in the "Form_Open" event and likewise if you want to log the form close time put it in the "Form_Closed" event and edit the wording on the first line accordingly. This way you will have a time stamp of the event in the UsysLog table with your own wording.
With multi-user databases we usually take it a step further and capture the user name with a login screen or the computer name (which can be done automatically) and drop that in the table as well so you know exactly who did the operation as well.
Please take a look at http://www.accesshelpebook.com/ and see if you can't take advantage of all of the examples found in our Access Help Ebook to help you make your databases more robust.
Our Office Automation Services include solutions used by both large and small companies that are affordable and easy to use. Our products and services are proven to enable our customers to provide better service to their customers while saving them money in the process. Our customers find that their return on investment is most often realized after using their applications just a few times.
What could BioMation Systems do for you?
Go ahead, take another look.
- Related Videos
- Related Articles
- Ask / Related Q&A
- Run Business Smoothly Through Business Cash Flow Loans
- Cash Flow Loans: Fix Up Your Business Financial Needs
- How Cash Flow Business Can Enable You To Work From Home
- Russ Dalbey And The Winning In The Cash Flow Notes Business
- Innovative Cash Flow Opportunity Ways and Means
- Cash Flow Loans: One Stop Solution for Every Need
- Cash Flow Loans: Short Term Finance for Every Requirement
- Cash Flow Loans: Reduce Your Wary




Solar Electric Energy-Cheapest Solar Electric Energy
By: N Jamal | 24/12/2009Solar power is the energy of the future. Learn how to get the cheapest solar electric energy. A few of quite a lot of the advantages of solar energy are first and foremost its free, easy to harness and is capable to provide more energy than what is needed by most homes and businesses.
Solar Electricity Energy-Cheapest Solar Electricity Energy
By: N Jamal | 24/12/2009Solar power is the energy of the future. Learn how to get the cheapest solar electricity energy. A few of quite a lot of the advantages of solar energy are first and foremost its free, easy to harness and is capable to provide more energy than what is needed by most homes and businesses.
Solar Energy Electricity-Cheapest Solar Energy Electricity
By: N Jamal | 24/12/2009Solar power is the energy of the future. Learn how to get the cheapest solar energy electricity. A few of the several advantages of solar energy are first and foremost its free, easy to harness and is capable to provide more energy than what is needed by most households and businesses.
Solar Power Electric Systems-Cheapest Solar Power Electric Systems
By: N Jamal | 24/12/2009Solar power is the energy of the future. Learn how to get the cheapest solar power electric systems. A few of the numerous advantages of solar energy are first and foremost its free, easy to exploit and is capable to provide more energy than what is needed by most homes and businesses.
Solar Electric Power System-Cheapest Solar Electric Power System
By: N Jamal | 24/12/2009Solar power is the energy of the future. Learn how to get the cheapest solar electric power system. A few of the several advantages of solar energy are first and foremost its free, easy to harness and is capable to provide more energy than what is needed by most homes and businesses.
Solar Power Electricity Generation-Solar Power Electricity Generation Is Easy
By: N Jamal | 24/12/2009Solar power is the energy of the future. Contrary to the popular belief solar power electricity generation is easy! A few of quite a lot of the advantages of solar energy are first and foremost its free, easy to harness and is capable to provide more energy than what is needed by most homes and businesses.
Solar Electric Power Generation-Solar Electric Power Generation Is Easy
By: N Jamal | 24/12/2009Solar power is the energy of the future. Contrary to the popular belief solar electric power generation is easy! A few of quite a lot of the advantages of solar energy are first and foremost its free, easy to harness and is capable to provide more energy than what is needed by most homes and businesses.
Solar Power Electric System-Cheapest Solar Power Electric System
By: N Jamal | 24/12/2009Solar power is the energy of the future. Learn how to get the cheapest solar power electric system. A few of the numerous advantages of solar energy are first and foremost its free, easy to exploit and is capable to provide more energy than what is needed by most homes and businesses.
Ms Access Tip – you Have Heard ofs, Now Learn to Use Them
By: Jon Watson | 11/01/2008 | ManagementThis example demonstrates using an array and SQL statements to create the similar records. It also has a function to replace records if you want to change the amount value and update the data table. The replace function assumes that the description and date are the same and replaces every occurrence of the existing record with the latest amount value. For safekeeping the replace function makes a copy of the data table before executing.
Ms Access Tip – How to Use Variables in the Access Query Design Form
By: Jon Watson | 26/12/2007 | ManagementIn this example you are going to learn how to enter or select data in one form and open another form with more data related to the field you just selected by taking advantage of global variables in the query design form
Ms Access Tutorial - How to Use Color Coding to Enhance your Applications
By: Jon Watson | 18/12/2007 | ManagementColor coding adds value to a form as it easily directs the user's eye to critical data. This is a powerful technique that allows a user to quickly evaluate a pages of data for errors or warning information.
How to Get the Most From your Training Dollar
By: Jon Watson | 12/12/2007 | ManagementThere are so many people telling you that you can make such a huge return on your investment these days that you just can't believe any of them any longer. I know, I have received so many get rich emails that I should be earning about a billion a day now! How about investing in something that you really believe in. Yourself.
Ms Access Tip: Self Learning Combo Box
By: Jon Watson | 12/11/2007 | TechnologyDatabase data entry can be tedious at times. You can make your databases more user friendly if they have a way to select data to enter rather than typing in the same data over and over. Access provides a form control called a combo box to help with this task but it can lead to trouble.
Access Databasetip: Create a User Defined Search Field for a List Box
By: Jon Watson | 02/11/2007 | TechnologyMany times it is necessary to provide your users with an easy way to filter or search for data in large table of information. This tip will show you one quick and easy way to solve the problem by giving the user a field to enter a search string and updating the form with those fields that fit the search pattern. It's quick and easy, so give it a try. Read about how Access was a big success solving a license tracking issue in this article.
Access Database Tip: How to Multiselect in a Listbox
By: Jon Watson | 26/10/2007 | TechnologyWhen you have a list box it is handy to be able to multiselect to perform some action on multiple items in the listbox. Here is a simple set of instructions to get you started. These instructions will create a quick way to multiselect and delete rows from a table.