Adding multiple totals

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nasher
    New Member
    • Feb 2008
    • 7

    #1

    Adding multiple totals

    This is so frustrating becuase i know this has a simple solution, but i just cant get it to work!

    Basically i have several subforms on a page (continuous forms) and they all have a simple sum function in a text box. sum=([quantity]).

    I now want to add all the totals and display them on the page in a text box.

    I've been trying to use the expression bulider but i cant get it to work.
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Originally posted by Nasher
    Basically i have several subforms on a page (continuous forms) and they all have a simple sum function in a text box. sum=([quantity]).

    I now want to add all the totals and display them on the page in a text box...
    In the unbound text box that is to hold all the totals you should be able to add the following as the control source, substituting for the subform name and each control's name as appropriate:
    Code:
    =Me![subformname].form![ControlTotalName1] + Me![subformname].form![ControlTotalName2] + ...
    This simply adds the values in each of the specified controls; if one of them is null this would fail. If a null value is at all likely then use the Nz function accordingly:
    Code:
    =Nz(Me![subformname].form![ControlTotalName1],0) + Nz(Me![subformname].form![ControlTotalName2],0) + ...
    I assume that your reference to the totals formula for your subform controls as sum=([quantity]) is just a typo, and that you meant
    =sum([quantity]) instead.

    -Stewart

    Comment

    Working...