Beginning Access 2002 VBA (Programmer to Programmer)

One thing this report lacks is totals. Since we are showing sales figures on a month-by-month basis, we really ought to show totals for each company.

Try It Out-Adding Totals

  1. Switch the report back to Design view.

  2. Add a new textbox into the CompanyName Footer . Call it txtCompanyTotal .

  3. Change the label of the new text box to Total :

  4. Put the following in the Control Source for the new field:

    =Sum([SumOfQuantity])

  5. Switch to Preview mode:

How It Works

You've seen the use of functions in fields, and Sum is just another function. When sum is used on a group footer, the argument you give it is the name of the field in the Detail Section . In our case this is SumOfQuantity - that's the field from the underlying query. All Sum does is sum up the values for the field in the Detail Section . It's as simple as that.

 

Категории