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

11.1. Event Properties

Event properties are used in reports, much the same way that they are in forms. The difference is that there are no properties that the user can initiate. Everything is done by the developer. There are no buttons to click, no combo boxes to open, or no data validation to perform.

Figure 11-1 and the following table display the extent of the event properties, and what causes them to be executed for a report. Some of these properties will be demonstrated in the code samples later in the chapter

Figure 11.1. Figure 11-1
PropertyTriggers When. . .
On OpenThe report is opened
On CloseThe report is closed
On ActivateThe report preview window is activated
On DeactivateThe report preview window is deactivated
On No DataThe recordsource of the report contains no records
On PageAfter a page is formatted, but before it is printed
on ErrorAn error occurs during the execution of code

11.1.1. Associating Code to an Event Property

When you are ready to begin associating VBA code to an event property, this is how you instruct Access to use your VBA code: You can start from either the Design View of the Report or from the VBA Editor window itself. Both methods are useful, and the times at which you utilize them will depend on your current location (Report or Editor) at the time that you need to start a new procedure.

From the Report Design window, click to highlight the desired ...

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