Microsoft KB Archive/93927

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

Article ID: 93927

Article Last Modified on 5/9/2003

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition

-



This article was previously published under Q93927



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



SUMMARY
This article describes how to create a report that prints &quot;continued&quot; or &quot;Group Name continued&quot; 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 &quot;RepeatSection&quot; using the Microsoft Access for Windows 95 Help Index.  Open the sample database NWIND.MDB. Open the List Of Products By Category report in Design view.  Click Code on the View menu and add the following line to the Declarations section: Option Explicit Dim MyFlag As Integer   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 = &quot;Courier&quot;   ' Use Courier font. Me.FontSize = 10  ' Use point size of 24 points. Message = [category name] & &quot; Continued&quot;  ' 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                     Add the following code to the OnFormat event property of the Category Name Header section: MyFlag = True   Add the following code to the OnFormat event property of the Category Name Footer section: MyFlag = False </li>  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 <pre class="fixed_text">     .34 + .25 = .59 and then set the Height property to .59 in. </li> Save and run the report.</li></ol>

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:

88156 ACC: &quot;Continued...&quot; Header for Groups That Span Multiple Pages

<div class="references_section">