Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Create a 'Continued' Header with Groups That Span Multiple Pages


View products that this article applies to.

This article was previously published under Q207624
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

↑ Back to the top


Summary

This article shows you how to create a label that prints at the top of each report page when a data group spans multiple pages.

The events used in this technique capture the value of the group in the page footer. If this value is the same as the page header value on the next page, a label stating "Continued from previous page ..." is printed at the top of the page.

↑ Back to the top


More information

To create a "Continued from previous page ..." label that prints at the top of each report page when a data group spans multiple pages, follow these steps:
  1. Start Microsoft Access and open the sample database Northwind.mdb.
  2. Create a new module. Type or paste the following Public declaration and functions in the module:
    Public CurrentGroupVal as String
    
    Function SetGlobalVar (InReport as Report)
       CurrentGroupVal = InReport!SetGroupVal
    End Function
    
    Function SetContinuedLabel (InReport as Report)
       If InReport.Page <> 1 then
       InReport!ContinuedLabel.Visible = _
          IIf(Trim(InReport!CheckGroupVal) = _
              Trim(CurrentGroupVal), True, False)
       End If
    End Function
    					
  3. Create a new report in Design view, basing it on the Customers table.
  4. If the field list is not already visible, click Field List on the View menu.
  5. Drag the CompanyName and City fields to the detail section.
  6. To display the property sheet of the detail section, right-click anywhere in the detail section that is not occupied by a control.
  7. Set the Height property of the detail section to 0.75". Close the property sheet.
  8. On the View menu, click Sorting and Grouping.
  9. In the Sorting and Grouping dialog box, click the first Field/Expression row, and then select Country from the list. Set the GroupHeader property to Yes, and then close the Sorting and Grouping dialog box.
  10. Drag the Country field from the field list to the country header section.
  11. Set the Height property of the country header section to 0.5".
  12. Set the Height property of the page header section to 0.5".
  13. Add a label to the page header section, and then set its Caption property to Continued from previous page ....
  14. Set the Name property of the label to ContinuedLabel, and then set its Visible property to No.
  15. Add a text box to the page header section, and then set its properties as follows:
    Name: CheckGroupVal
    ControlSource: Country
    Visible: No
  16. Set the On Print property of the page header as follows:
    =SetContinuedLabel(Report)
  17. Add a text box to the page footer section of the report, and then set its properties as follows:
    Name: SetGroupVal
    ControlSource: Country
    Visible: No
  18. Set the On Print property of the page footer as follows:
    =SetGlobalVar(Report)
  19. Set the Height property of the page footer to 0.5".
  20. Preview the report. Note that the "Continued from previous page ..." label appears at the top of any page whose Country details span more than one page.
Note that these steps are for illustrative purposes only. Your report may require adjustments other than those mentioned. You may want to prevent a section from being split across pages by setting its KeepTogether property to Yes. In the example, you may also want to set the ForceNewPage property of the country header section to Before Section to help control the page layout.

You can also use the GrpKeepTogether property to keep groups of records together or to keep the group header with the first record in the group. You may want to experiment with this property to see how it affects your report's layout.

↑ Back to the top


References

For more information about keeping sections or groups of records together, click Microsoft Access Help on the Help menu, type grpkeeptogether property in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

↑ Back to the top


Keywords: KB207624, kbinfo, kbhowto

↑ Back to the top

Article Info
Article ID : 207624
Revision : 2
Created on : 6/28/2004
Published on : 6/28/2004
Exists online : False
Views : 308