Chapter 25Using Report Events

When an Access report is run, a number of events can occur. The following examples demonstrate how to control what happens not only when the report is opened, activated, deactivated, or closed, but also when there are no records for the report to display or the report record source simply does not exist.


The Open event for a report occurs when the report is opened. Use this event to display support forms or custom buttons, or to change the record source for the report. The event procedure in Hands-On 25-1 demonstrates how to change a report’s record source on the fly.

Hands-On 25-1: Writing the Report_Open Event Procedure

1. Start Microsoft Office Access 2007 and create a new Microsoft Office Access 2007 database ...

Get Access 2007 Programming by Example with VBA, XML, and ASP now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.