Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Total Missing (Access 2000)

    I have a subform listing a number of amounts with a total in the footer (in, say, txtSubTotal). I have a numeric field in the main form (say Budget) and a text box on the main form (txtBudgetTotal) with =Budget + txtSubTotal.

    This all works OK as long as one or more of the subform numeric fields have data in them, but if data has not yet been entered into the sub form, the subform total (txtSubTotal) and the main form txtBudgetTotal show up empty -- not even a zero! At least the main form should show a total equal to Budget, and the sub form total should equal 0.

    If I enter a zero into one of the subform rows, then everything works properly.

    Any suggestons as to why these totals don't work?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Total Missing (Access 2000)

    If all values in the subform are blank, the sum is null, not zero. You can set the Control Source of the txtSubTotal text box in the subform footer to

    <code>=Nz(Sum([NameOfField]),0)</code>

    The Nz function will replace a null result of the first argument (the sum) with the second argument, here 0. This will cause txtBudgetTotal to display the value of Budget.

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Total Missing (Access 2000)

    Thanks again Hanx. That works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •