Add a page break to a report

Microsoft Office Access 2003

In reports, you use a page break control to mark where you want to start a new page within a section. For example, if you want a report's title page and introductory message printed on separate pages, place a page break in the report header after the controls that you want to appear on the title page and before the controls for the second page.

  1. Open the report in Design view.
  2. Click the Page Break tool Button image in the toolbox.
  3. Click where you want to place the page break. Place the page break above or below a control to avoid splitting data in that control.

    Microsoft Access marks the page break with a short dotted line on the left edge of the report.

Notes

  • If you want each group or record in a report to start on a new page, set the ForceNewPage property of the group header, group footer, or detail section.

  • The Catalog report in the Northwind sample database has an example of using a page break in the report header. To view this report, open the Northwind database in your Microsoft Office folder's Samples folder, and then open the Catalog report in Design view.

ShowForce a page break if a condition is met

You can force a page break in a report if a condition is met by setting the Visible property of a page break control in a macro or an event procedure.

  1. Open the report in Design view.
  2. Click the Page Break tool Button image in the toolbox.
  3. Click where you want to place the page break.
  4. Do one of the following:

    ShowCreate a macro

    1. Click Properties Button image on the toolbar, and specify a name for the page break control in the Name box.
    2. In the Database window, click Macros Button image under Objects.
    3. Click the New button on the Database window toolbar.
    4. In a blank action row, click SetValue in the action list.
    5. Set the Item argument to the identifier for the Visible property of the page break control. For example, if the name of the control is CondPgBreak, set the Item argument to [CondPgBreak].[Visible].
    6. Set the Expression argument to No.
    7. Click Save Button image to save the macro.
    8. In report Design view, set the OnFormat property of the report's page header section to the name of the macro.
    9. This hides the page break control when the report starts formatting each page, so the page doesn't break.

    10. Create a second macro that sets the Visible property of the page break control to Yes when a conditional expression is met. As you can see from the following example, to make a page break occur if the Counter control in the detail section is 10, set the detail section's OnFormat property to the name of the second macro.

      Select an action to carry out when a condition that you specify is met

    11. Click Save to save the macro.
    12. Select the section where you placed the page break, and set the section's OnFormat property to the name of the second macro. In the preceding example, to make a page break occur if the Counter control in the detail section is 10, set the detail section's OnFormat property to the name of the second macro.
    13. When the condition is met, the page breaks. After the page is broken, the macro attached to the page header hides the page break control until the condition is met again.

    ShowCreate an event procedure

    1. Double-click the section selector of the page header.
    2. On the Event tab in the property sheet, click the OnFormat property.
    3. Click Build Button image next to the property box to display the Choose Builder dialog box.
    4. Double-click Code Builder to display the event procedure Sub and End Sub statements in the report module.
    5. In the event procedure, add an assignment statement that sets the Visible property of the page break control to No. For example, if the name of the control is CondPgBreak, add the following assignment statement:
      Me![CondPgBreak].Visible = False
      										

      This hides the page break control when the report starts formatting each page, so the page doesn't break.

    6. In the Format event procedure of the section where you placed the page break, add Microsoft Visual Basic code that sets the Visible property to Yes when a condition is met. For example, to make the detail section break when the value of the Counter control reaches 10, add the following code to the Detail_Format event procedure:
      If Me![Counter] = 10 Then
       Me![CondPgBreak].Visible = True
      End If