RunningSum Property

Applies To

Report, Text Box control.

Description

You can use the RunningSum property to calculate record-by-record or group-by-group totals in a report. The RunningSum property specifies whether a text box on a report displays a running total and lets you set the range over which values are accumulated. For example, you can group data by month and show the sum of each month's sales in the group footer. You can show the running sum of accumulated sales over the entire report (sales for January in the January footer, sales for January plus February in the February footer, and so on) by adding a text box to the footer that shows the sum of sales and setting its RunningSum property to Over All.

Note The RunningSum property applies only to a text box on a report.

Setting

The RunningSum property uses the following settings.

Setting

Description

Visual Basic

No

(Default) The text box displays the data from the underlying field for the current record.

0

Over Group

The text box displays a running sum of values in the same group level. The value accumulates until another group level section is encountered.

1

Over All

The text box displays a running sum of values in the same group level. The value accumulates until the end of the report.

2


You can set the RunningSum property by using the text box's property sheet, a macro, or Visual Basic. You can set the RunningSum property only in Design view.

Remarks

Place the text box in the Detail section to calculate a record-by-record total. For example, to number the records appearing in a detail section of a report, set the ControlSource property for the text box to "=1", and set the RunningSum property to Over Group.

Place the text box in a group header or group footer to calculate a group-by-group total.

You can have up to 10 nested group levels in a report.

Example

The following example shows a sales report with two group levels — Month and Type of Food. Each text box in the Type of Food group footer (January Chocolates, January Meat, and so on) contains the following expression:

=Sum([Sales])
The RunningSum property of each text box is set to one of the three different values: No, Over Group, and Over All.

Group levels

No

Over Group

Over All

Month: January

Type of Food: Chocolates

02-Jan

25

22-Jan

75

January Chocolates

100

Jan Food
100

YTD Sales
100

Type of Food: Meat

03-Jan

90

20-Jan

60

January Meat

150

Jan Food
250

YTD Sales
250

Month: February

Type of Food: Chocolates

05-Feb

70

19-Feb

80

February Chocolates

150

Feb Food
150

YTD Sales
400

Type of Food: Meat

12-Feb

150

22-Feb

100

February Meat

250

Feb Food
400

YTD Sales
650


Example

The following example sets the RunningSum property for a text box named SalesTotal to 2 (Over All):

Reports!rptSales!SalesTotal.RunningSum = 2