Table of contents
TOC
Collapse the table of content
Expand the table of content

GroupLevel.GroupOn Property (Access)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

You can use the GroupOn property in a report to specify how to group data in a field or expression by data type. For example, this property lets you group a Date field by month. Read/write Integer.

Syntax

expression. GroupOn

expression A variable that represents a GroupLevel object.

Remarks

The GroupOn property settings available for a field depend on its data type, as the following table shows. For an expression, all of the settings are available. The default setting for all data types is Each Value.

Field data typeSettingGroups records withVisual Basic
Text(Default) Each ValueThe same value in the field or expression.0
Prefix CharactersThe same first n number of characters in the field or expression.1
Date/Time(Default) Each ValueThe same value in the field or expression.0
YearDates in the same calendar year.2
QtrDates in the same calendar quarter.3
MonthDates in the same month.4
WeekDates in the same week.5
DayDates on the same date.6
HourTimes in the same hour.7
MinuteTimes in the same minute.8
AutoNumber, Currency, Number(Default) Each ValueThe same value in the field or expression.0
IntervalValues within an interval you specify.9

In Visual Basic, you set this property in the Open event procedure of a report.

To set the GroupOn property to a value other than Each Value, you must first set the GroupHeader or GroupFooter property or both to Yes for the selected field or expression.

Example

The following example sets the SortOrder and grouping properties for the first group level in the Products By Category report to create an alphabetical list of products.

Private Sub Report_Open(Cancel As Integer) 
    ' Set SortOrder property to ascending order. 
    Me.GroupLevel(0).SortOrder = False 
    ' Set GroupOn property. 
    Me.GroupLevel(0).GroupOn = 1 
    ' Set GroupInterval property to 1. 
    Me.GroupLevel(0).GroupInterval = 1 
    ' Set KeepTogether property to With First Detail. 
    Me.GroupLevel(0).KeepTogether = 2 
End Sub

See also

Concepts

GroupLevel Object

© 2018 Microsoft