To run a macro when the Format event occurs, set the OnFormat property to the name of the macro.
Remarks
You can use the FormatCount property to check whether the Format event has occurred more than once for a section. For example, if a section doesn't fit on one page and part of it moves to the next page of the report, the Format event occurs once for each page, and the FormatCount property is set to 2. You can check the FormatCount property setting to determine how many times a Format macro has run per section.
You can use the CancelEvent action in a Format macro to cancel formatting of a section. If you cancel formatting, Microsoft Access doesn't format the section for printing and prints the next section instead. You can use the CancelEvent action to skip a section in a report without leaving a blank space on the page when the report is printed.