Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2006
    Posts
    250
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Putting total in a form (2003)

    Hello,

    I am creating a form with two tables. One table has the company information and the second contains the budget information. The budget information is a subform in the main form (company information). The budget Information table has a budget amount field where users will be asked to enter information. I need to put in a running total as new amounts are entered. What is the best way to do this. Thanks.

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

    Re: Putting total in a form (2003)

    You can put a text box in the form footer of the subform whose Control Source looks like
    <code>
    =Sum([NameOfField])
    </code>
    where NameOfField is the name of the budget amount field. If you wish, you can put a text box on the main form that refers to the text box in the form footer of the subform:
    <code>
    =[SubformName]![TextboxName]
    </code>
    The Orders form in the Northwind sample database that comes with Access demonstrates this.

  3. #3
    Lounger
    Join Date
    Nov 2006
    Location
    Denver, Colorado, USA
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Putting total in a form (2003)

    You could put a calculated control on the main form and position it under the budget amount controlin the sub form. Use "=DSum("budget_amount_field", "budget_table", "customer_id_field = " & [customer_id_field_name_in_main_form])" as the control source. Each time a record is added/updated/or deleted in the sub form the subform AfterUpdate event should requery the summary control in the main form (me.parent.summary_control_name.requery). That way the summary amount would stay in sync with the details.

Posting Permissions

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