To create an event procedure that runs when the Format event occurs, set the OnFormat property to [Event Procedure], and click the Build button .
Syntax
Private Sub sectionname_Format(Cancel As Integer, FormatCount As Integer)
The Format event procedure has the following arguments.
Argument | Description |
---|---|
sectionname | The name of the report section whose Format event procedure you want to run. |
Cancel | The setting determines if the formatting of the section occurs. Setting the Cancel argument to True (–1) cancels formatting of the section. |
FormatCount | An Integer value that specifies 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, Microsoft Access sets the FormatCount argument to 2. |
Remarks
If you cancel formatting, Microsoft Access doesn't format the section for printing and prints the next section instead. You can use this event procedure to skip a section in a report without leaving a blank space on the page when the report is printed.