O'Reilly logo

Access 2003 VBA Programmer's Reference by Armen Stein, Graham Seach, Teresa Hennig, Patricia Cardoza

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.1. When Events Fire

Events are at the heart of event-driven programming—which is no surprise. What can be surprising to novice programmers is the sheer number of events available to use. They all beg to have some code behind them. In reality though, very few events are used on a consistent basis. Most of them have absolutely no code behind them, and never will in normal usage. The trick is to know which ones are important and commonly used, and which ones are obscure and hardly ever used. They all look equally important in Access Help.

8.1.1. Common Form Events

To cut to the chase, here's a list of commonly used events and how you might want to use them. If you know how to use this basic set of events, you're most of the way there to understanding event-driven programming in Access VBA.

  • Form—On Open: The Open event for a form fires before the Load event, and before the recordset is evaluated for the form. This means you can use this event to change the recordset (by changing the Where or Order By clause) before the form continues to load. This event can be cancelled, which means the form will not continue to the Load event.

  • Form—On Load: The Load event for a form fires after the recordset for the form has been evaluated, but before the form is displayed to the user. This offers you an opportunity to make calculations, set defaults, and change visual attributes based on the data from the recordset.

  • Form—Before Update: If you want to perform some data edits before the user's changes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required