Summarizing

team lib

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:

    click to expand

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.

 
team lib


Beginning Access 2002 VBA
Beginning Access 2002 VBA (Programmer to Programmer)
ISBN: 0764544020
EAN: 2147483647
Year: 2003
Pages: 256

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net