ACC: How to Repeat Subreport Header at Top of PageLast reviewed: October 24, 1997Article ID: Q120907 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. This article describes how to repeat a subreport's header when the subreport spans multiple pages. NOTE: This method works best for one subreport. Attempting to repeat the subreport header for multiple subreports requires a set of controls in the page header and a flag for each subreport. Then the code must check each flag and hide or show the appropriate sets of controls. This code is not easy to maintain. NOTE: This article explains a technique demonstrated in the sample files, RptSampl.exe (for Microsoft Access for Windows 95 version 7.0) and RptSmp97.exe (for Microsoft Access 97). For information about how to obtain these sample files, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q145777 TITLE : ACC95: Microsoft Access Sample Reports Available on MSL ARTICLE-ID: Q175072 TITLE : ACC97: Microsoft Access 97 Sample Reports Available on MSL MORE INFORMATIONThe method demonstrated in the following example uses a flag in the page header to indicate whether the subreport spans multiple pages. When the subreport's report header is printed the flag is set to 1. When the subreport's report footer is printed, the flag is set to 0. When the page header is printed, if the flag is set to 1 then the subreport spans multiple pages and the subreport's header should be repeated. The following example demonstrates how to cause a subreport's header to be repeated if the subreport spans multiple pages:
Displaying Main Report Information on Every PageThe example above assumes that you do not want anything except the subreport header to be printed in the main report's page header. If you do want to print other information, you will need to hide and unhide each subreport header control in the page header. Change the MainPH macro in step 2 above to:
Macro Name Condition Action ------------------------------------------------- MainPH [Flag]=0 SetValue Item: [Text1].visible Expression: False ... SetValue Item: [Text2].visible Expression: False ... SetValue Item: [Text3].visible Expression: False [Flag]=1 SetValue Item: [Text1].visible Expression: True ... SetValue Item: [Text2].visible Expression: True ... SetValue Item: [Text3].visible Expression: True REFERENCESFor more information about events during printing, type "Print Events" in the Office Assistant, click Search, and then click to view "Print Event." For more information about report OnFormat and OnPrint properties, search on "OnFormat," and "OnPrint," using the Microsoft Access 97 Help IndexKeywords : RptSub kbusage Version : 1.0 1.1 2.0 7.0 97 Platform : WINDOWS Hardware : x86 Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |