The Database Journal
03/10/2006
Adjusting Autonumber Increments

03/10/2006
Moving Access Data to Microsoft Excel

03/10/2006
Exporting Access Data with TransferSpreadsheet

03/10/2006
Export Access Data with VBA

03/13/2006
Data Layout in Microsoft Excel

03/17/2006
Excel Text to Number Conversion

03/21/2006
Transposing Excel Ranges

03/25/2006
Access VBA Timer Event

03/29/2006
What is MySQL?

04/02/2006
Microsoft Access Parameter Query Tutorial Video

04/06/2006
How does PHP Work?

04/10/2006
Microsoft Access VBA Tools - References

Click here to view all articles.

Database Design
Website Design
Search Engine Marketing
Home
Contact Us
About Us
Database Journal
Newsletters
Database Newsletter

Access VBA Timer Event

The Microsoft Access Form Timer event allows you to execute a macro or piece of code automatically at set intervals. This is something you would use to periodically update some records, refresh some data, or have any sort of timed database event.

You may have the urge to stretch that definition into a question such as, "Can I have Access automatically do XYZ every night while I'm sleeping safe and sound at home?"

Don't fall into that trap. The Form Timer event is generally used very rarely and for good reason. First, you must have Access open in order for this to occur. Second, you must have that specific Form open as well. Third, there's a limit of 65,000 milliseconds for intervals. There's no easy scheduling such as, "At 9:00PM run this code."

Futhermore, little problems like network access, low resources, and general instability can really wreak havoc with something that's on a timed event. For small processes and relatively low-importance tasks, the Form Timer event might be a good way to go, but if you need on-the-clock processing to be done, it's better to stick with something slightly more reliable

Enter: Task Scheduler. This Windows utility can open an application at a specific time which can in turn run code. Again, you'll be facing similar "timing" issues such as making sure the PC is on during the time that this event should occur and making sure that everything is in working order for it to process it's data.

If you happen to work in an office where co-workers are kind enough to shut your PC down at night, you could have issues with the code not running. If network maintenance is being done at the same time that your code is scheduled to run, you could have further problems. There are many variables outside of your scope of control that may cause poor results.

Your best rule of thumb is to have a look at the process being done. If that process were to fail, would your database be in horrific shape? Would dozens of people be knocking at your door ready to scream? Then don't use a timer event or the task scheduler. Find another way to get the job done at a different time, or use a different system that's somewhat more robust in order to achieve your results. The last thing you want to do is set up some automation and have something go terribly wrong while you were at home sleeping safe and sound.

In the years that I've been designing databases, I've not had a single occasion where a Timer event has been absolutely necessary. Most clients are more than happy launching a set of automated tasks manually considering the bad alternative of a loss of data or more importantly, a loss of time.


©2014 Blue Moose Technology, LLC

David Badurina, President of Blue Moose Technology, LLC, is a relational database design expert. David's unique ability to easily explain virtually any technical concept has allowed him to work with companies such as AMD, Motorola, the American Heart Association, and countless small businesses. Learn more about database design right now at http://www.bluemoosetech.com.

Article Publishing and Re-Print Guidelines

You can easily link to this article!

If you'd like to link to this article from your own website, copy and paste the following HTML code onto your page:

On your page, the code will appear like this:

Access VBA Timer Event