GroupInterval Property

Applies To

Report, Sorting And Grouping Box.

Description

You can use the GroupInterval property with the GroupOn property to specify how data is grouped in reports. The GroupInterval property specifies an interval value that data is grouped by. This interval differs depending on the data type and GroupOn property setting of the values in the field or expression you’re grouping on. For example, you can set the GroupInterval property to 1 if you want to group records by the first character of a product name.

Setting

The GroupInterval property settings are Integer values that depend on the field’s data type and its GroupOn property setting. The default GroupInterval setting 1.

You can set this property in the report’s Sorting And Grouping box, a macro, or Visual Basic.

You can set the GroupInterval property only in report Design view or in the Open event procedure of a report.

Remarks

Here are examples of GroupInterval property settings for different field data types.

Field data type

GroupOn setting

GroupInterval setting

All

Each Value

(Default) Automatically set to 1.

Text

Prefix Characters

Set to 3 for grouping by the first three characters in the field (for example, Chai, Chartreuse, and Chang would be grouped together).

Date/Time

Week

Set to 2 to return data in biweekly groups.

Date/Time

Hour

Set to 12 to return data in half-day groups.


To set the GroupInterval property to a value other than its default setting (1), you must first set the GroupHeader or GroupFooter property or both to Yes for the selected field or expression.

See Also

CreateGroupLevel Function; GroupHeader, GroupFooter Properties; GroupLevel Property; GroupOn Property; KeepTogether Property — Groups; SortOrder Property.

Example

The following example sets the sort order and group properties for the first group level in the Products By Category report.


Sub Report_Open()
    ' Set SortOrder property to descending order.
    Reports![Products by Category].GroupLevel(0).SortOrder = True
    ' Set GroupOn property to Prefix Characters.
    Reports![Products by Category].GroupLevel(0).GroupOn = 1
    ' Set GroupInterval property to 1.
    Reports![Products by Category].GroupLevel(0).GroupInterval = 1
    ' Set KeepTogether property to With First Detail.
    Reports![Products by Category].GroupLevel(0).KeepTogether = 2Sub