Access JumpStart 2.0 | Blog

A Rapid Development Framework for Microsoft Access

If you are using DoEvents in your VBA code to allow form updates or preventing Windows from labeling your Access app as Unresponsive, make sure you consider the potential ramifications.

DoEvents not only chimes in to the OS that it’s awake, but it also allows any other things Access might be waiting to do to get done and your code will then wait until it gets control back before it starts up again.

This means for example, that if you are trying to use DoEvents to run something in the background, and allowing users to continue interacting with Access, you could run into some difficult to debug side effects. Let’s say you are simply using DoEvents during a long import routine to allow a parent form to display messages. If you don’t take precautions (like disabling the Import button until the routine is complete), the user could click on the Import button again and you could well end up with the Import routine steamrolling over itself (let’s say it deletes all the records in a temp table to start, you wouldn’t want that happening while it was still processing the records it put in there).

So just be careful out there!