ACC2: Group KeepTogether Does Not Apply to Multi-Column Reports (125234)
The information in this article applies to:
This article was previously published under Q125234
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
The group KeepTogether property does not apply to multiple-column reports
as the "Creating Snaking Columns on a Report" online Help topic suggests.
The Help topic states, in part:
To keep the first detail record with the group header, in the Sorting
And Grouping box, set the KeepTogether Property--Groups for the group
header to With First Detail.
This statement is incorrect.
CAUSE
In a multiple-column report, the group KeepTogether property applies to the
entire page, not to the individual columns.
RESOLUTION
To avoid an abandoned group header at the bottom of a column, or to prevent
a group header from being printed beyond a certain position on the page,
use the following sample procedure as the event procedure for the group
header's OnPrint property. Modify the expression "(5 * 1440)" in the
procedure with the value beyond which you do not want a group header to be
printed. Note that the expression "(5 * 1440)" equates to 5 inches, because
there are 1440 twips in an inch. The sample procedure tests the report's
Top property (the position where the report will be printed) and if the
condition is true, causes the report not to be printed at that position but
instead moves down the page until the condition is false, which occurs at
the top of the next page. By default, the report's NextRecord and
PrintSection properties are set to True after each attempt to print a
section.
Sub GroupHeader3_Print (Cancel As Integer, PrintCount As Integer)
If Me.Top > (5 * 1440) Then
Me.NextRecord = False
Me.PrintSection = False
End If
End Sub
Note that this procedure works well if the Item Layout option in the Print
Setup dialog box for the columns is set to Vertical. If the Item Layout
option is set to Horizontal, you may want to set the NewRowOrCol property
for the group header section to Before & After.
STATUS
Microsoft Access version 7.0 includes a new report GrpKeepTogether
property that specifies whether groups that have their KeepTogether
property set to 'With First Detail' or 'Whole Group' will be kept together
by page or column.
REFERENCES
For more information about the GrpKeepTogther Property, search for
"GrpKeepTogether Property" using the Microsoft Access for Windows 95 Help
Index.
Modification Type: | Major | Last Reviewed: | 7/5/2002 |
---|
Keywords: | kbusage KB125234 |
---|
|