ACC: Repeating Group Name at Top of New Column or Page (1.x/2.0)

Last reviewed: May 8, 1997
Article ID: Q93927
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0

SUMMARY

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

This article describes how to create a report that prints "continued" or "Group Name continued" at the top of each new column or page when grouped information flows from one column or page to another.

MORE INFORMATION

Microsoft Access prints a single group header at the beginning of a group to identify the beginning of the group. It does not repeat the header at the top of subsequent columns or pages. However, you can use the procedure described below to force a report to repeat the group name if the records in a group span several columns or pages. This article uses the List Of Products By Category report from the sample database NWIND.MDB.

NOTE: The steps in this article are no longer necessary in Microsoft Access version 7.0. In Microsoft Access 7.0, you can use the RepeatSection property to repeat a Group Header at the top of a new column or page. For more information about the RepeatSection property search on the word "RepeatSection" using the Microsoft Access for Windows 95 Help Index.

  1. Open the sample database NWIND.MDB.

  2. Open the List Of Products By Category report in Design view.

  3. Click Code on the View menu and add the following line to the Declarations section:

          Option Explicit
          Dim MyFlag As Integer
    

  4. Add the following code to the OnFormat event property of the page header section:

          Dim Message As String
          Dim VerMes As Long
    

          If MyFlag = True Then
    
             Me.scalemode = 1
             Me.FontName = "Courier"    ' Use Courier font.
             Me.FontSize = 10   ' Use point size of 24 points.
             Message = [category name] & " Continued"   ' Text to be
                                                        ' displayed.
    
             VerMes = Me.TextHeight(Message)    ' Vertical height.
    
             Me.CurrentX = 800
             Me.CurrentY = Me.section(3).height - VerMes
             Me.Print Message
    
             MyFlag = False
          End If
    
    

  5. Add the following code to the OnFormat event property of the Category Name Header section:

          MyFlag = True
    

  6. Add the following code to the OnFormat event property of the Category Name Footer section:

          MyFlag = False
    

  7. Take the current value assigned to the Height property of the page header section and add .25 to that value. For example, if the current Height property of the page header section is .34 inches, add .25 to this value

          .34 + .25 = .59
    

    and then set the Height property to .59 in.

  8. Save and run the report.

NOTE: This process is designed to work only when physically printing the report. In Print Preview, you will find that the continued headings appear properly when navigating forward through the previewed pages, but while navigating backward through Print Preview, the continued headings do not preview appropriately. This is by design.

For additional information about this topic, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q88156
   TITLE     : ACC: "Continued..." Header for Groups That Span
               Multiple Pages

REFERENCES

For more information about printing conditional page headers, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q105516
   TITLE     : ACC: How to Print a Conditional Page Header in a Report

You can also obtain this article through Microsoft FastTips by ordering item number 105516 from the FastTips Main Menu.

For information about how to create multiple-page reports with snaking columns, search for "multiple-column reports," and then "Creating Snaking Columns on a Report" using the Microsoft Access Help menu.

You can find information, instructions, and examples in the Solutions sample application (SOLUTION.MDB) included with Microsoft Access version 2.0. For more information about printing a conditional page header, open the SOLUTION.MDB database, usually located in the ACCESS\SAMPAPPS directory. In the Select A Category Of Examples box, select "Control what you print on reports," and then in the Select An Example box, select "Repeat a group name at the top of a column or page."


Additional query words: multicolumn snaking-column
Keywords : kbusage RptSort
Version : 1.0 1.1 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbhowto


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.

Last reviewed: May 8, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.