Article ID: 208979 - Last Review: July 14, 2004 - Revision: 1.2 ACC2000: How to Print a Group Footer at a Specific LocationThis article was previously published under Q208979 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp). On This PageSUMMARY
This article describes how to print a report's Group Footer information at
a specific place on the page. This can be useful when you are printing
reports to preprinted forms. Although you cannot do this using the Group
Footer's property settings, you can use any of the following three
methods:
MORE INFORMATIONMethod 1: Using the Page FooterThe Page Footer is always printed at a fixed location on the report's page, just above the bottom margin. For example, if your report has a bottom margin of 1 inch and the height of the Page Footer is 1 inch, the Page Footer begins 2 inches from the bottom of the page (or 9 inches from the top of an 11-inch page). Placing the Group Footer controls in the Page Footer causes them to be printed at the Page Footer's fixed location on the page.NOTE: You cannot use aggregate functions such as Sum() or Count() in a Page Footer. For additional information about how to display aggregate results in your footer, click the article number below to view the article in the Microsoft Knowledge Base: 208850
(http://support.microsoft.com/kb/208850/EN-US/
)
ACC2000: How to Sum a Calculation in a Report
Method 2: Setting Report Properties for the Footer SectionThis method involves using the report's MoveLayout, PrintSection, and NextRecord properties to ensure that the Group Footer is not printed above a specific location on the page. With this method, you are not actually specifying the Group Footer's coordinates on the page, but advancing the Group Footer's print location until a specified vertical offset is reached.To ensure that the Group Footer is printed where you want it, you must consider the height of each section of the report. Since you cannot specify the location of the Group Footer section (or any other section) with a property setting, you must use the MoveLayout property to move the section to a suitable printing location. The report's MoveLayout property is False for every section by default, but it can be changed by an event procedure. For example, consider a Group Footer section with a Height of 0.5 inch which would print normally (that is, when the report's MoveLayout property is False) at a position 3.75 inches from the top of the report. If the section's OnFormat event sets the report's MoveLayout property to True, then as the Group Footer section is being formatted, its print location will be advanced by its own height, to a position 4.25 inches from the top of the report. The following example shows you how to print the Group Footer on the lower portion of the page by adjusting the section heights, and by using a sample user-defined function called SetGrpFtrLoc() that tests whether the report's Top property is less than the GrpFtrLoc setting (the location where the Group Footer should be printed). If it is, the function sets the report's MoveLayout property to True and the PrintSection and NextRecord properties to False, which moves the Group Footer section to the next printing location without printing it or bringing in data from another record. When the correct position is reached, the MoveLayout and PrintSection properties are the default values and the Group Footer is printed. You should be aware that this does not mean that the Group Footer will print precisely at the specified vertical offset (GrpFtrLoc); rather, the printing position will be advanced until that offset has been reached or exceeded. One consequence of this is that sections of the report, such as the Report Header section, which are printed on some pages but not on others, may cause small differences in Group Footer printing locations. You can avoid this by taking care in setting the heights of the various sections of your report, as the example illustrates. CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.
NOTE: The Page Header and Country Header sections do not need to be adjusted because they occupy the same amount of space on every page. If they appeared on some pages and not on others, their heights would also have to be adjusted. This method has some limitations. If you have a large number of detail records, or require the Group Footer to appear at a relatively high position on the page, you will find that the Group Footer is displaced toward the bottom of the page as the Detail sections print beyond the offset specified for their footer. Method 3: Setting Report Properties for the Detail SectionYou can use a similar approach with the MoveLayout, PrintSection, and NextRecord properties to advance a blank Detail section until the location for printing the Group Footer section is reached. This method is preferable to moving the Group Footer section if the Detail section is smaller than the Group Footer section, and particularly when the Detail sections must not intrude into an area reserved for the Group Footer, as with pre-printed forms.The following example shows you how to print the Group Footer at a specific place on the page by using a sample user-defined function called SetDetailLoc() and controlling a page break in the Detail section of the report.
REFERENCESFor more information about the MoveLayout,NextRecord, and PrintSection report properties, click Microsoft Help on the Help menu, type MoveLayout, NextRecord, PrintSection Properties in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
| Article Translations
|
Back to the top
