편집

다음을 통해 공유


GroupLevel.KeepTogether property (Access)

Use the KeepTogether property for a group in a report to keep parts of a group (including the group header, detail section, and group footer) together on the same page. For example, you might want a group header to always be printed on the same page with the first detail section. Read/write Byte.

Syntax

expression.KeepTogether

expression A variable that represents a GroupLevel object.

Remarks

The KeepTogether property for a group uses the following settings.

Setting Visual Basic Description
No 0 (Default) Prints the group without keeping the group header, detail section, and group footer on the same page.
Whole Group 1 Prints the group header, detail section, and group footer on the same page.
With First Detail 2 Prints the group header on a page only if it can also print the first detail record.

In Visual Basic, you set the KeepTogether property for a group in report Design view or the Open event procedure of a report by using the GroupLevel property.

To set the KeepTogether property for a group to a value other than No, you must set the GroupHeader or GroupFooter property or both to Yes for the selected field or expression.

A group includes the group header, detail section, and group footer. If you set the KeepTogether property for a group to Whole Group and the group is too large to fit on one page, Microsoft Access will ignore the setting for that group. Similarly, if you set this property to With First Detail and either the group header or detail record is too large to fit on one page, the setting will be ignored.

If the KeepTogether property for a section is set to No and the KeepTogether property for a group is set to Whole Group or With First Detail, the KeepTogether property setting for the section is ignored.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.