INF: How to Make Report Footer Print at Bottom of Last Page

    Article ID: Q119783
    Creation Date: 23-AUG-1994
    Revision Date: 01-DEC-1996

    The information in this article applies to:

    • Microsoft Access versions 2.0, 7.0, 97

    SUMMARY

    Moderate: Requires basic macro, coding, and interoperability skills.

    The report footer is printed at the end of a report, immediately following the last section in the report. Because it immediately follows the last section in the report, the report footer may not be printed at the bottom of the last page. This article describes a method of printing the report footer information at the bottom of the last page by including the information in a page footer and making the information visible only on the last page of the report.

    MORE INFORMATION

    This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.

    NOTE: Visual Basic for Applications is called Access Basic in Microsoft Access version 2.0. For more information about Access Basic, please refer to the "Building Applications" manual.

    The following example demonstrates a method that compares the Page and the Pages properties to determine if the current page is the last page of the report, and if so, makes the information in the page footer visible.

    1. Create a new report and place the following label control in the report's page footer section:

            Label:
               Name: ReportFooterText
               Caption: This is the last page
               Visible: No
      
    2. Create the following text box control in the page footer section:

            Text Box:
               Name: PageNumber
               ControlSource: =[Page] & " of " & [Pages]
      
    3. Set the page footer's OnPrint property to the following event procedure:

            Sub PageFooter2_Print (Cancel As Integer, PrintCount As Integer)
               If Me.page = Me.pages Then
                  ReportFooterText.visible = True
               Else
                  ReportFooterText.visible = False
               End If
            End Sub
      

    REFERENCES

    For more information about the Page and the Pages properties, search for "Page Property" using the Microsoft Access 97 Help Index.


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

KBCategory: kbusage
KBSubcategory: RptLayou
Additional reference words: 2.00 7.00 97 8.00