Tags: access, amount, calculation, control, customer, database, dsum, form, microsoft, mysql, oforders, oracle, sql, subform, subtract, totals, value, working

How do I subtract one dsum amount from another

On Database » Microsoft Access

1,988 words with 1 Comments; publish: Sat, 07 Jun 2008 20:01:00 GMT; (25078.13, « »)

I have a dsum calculation working in a form control (it totals the value of

orders for a customer). I have another working in a subform of the main form

(totalling payments received for the same customer). I want to deduct the

payments received from the balance. How can I subtract one dsum amount from

the other to achieve this. I have tried many different ways, but always get

the syntax wrong (the dreaded "#error")!

All Comments

Leave a comment...

  • 1 Comments
    • First, you may run into problems basing a calculated control on other

      calculated controls due to timing issues. Give it a try and if it works,

      great; but if it doesn't, you'll need to rerun the DSum()'s in the "final"

      control.

      That said, the syntax will depend on where this "final" control is at. If

      the control is on the main form then

      =txtBalance - NameOfSubformControl.Form.txtTotalPayments

      if the control is on the subform

      =Parent.txtBalance - txtTotalPayments

      if Parent doesn't work (it worked in testing), try the full path to the

      parent form

      =Forms!frmParentFormName!txtBalance

      The NameOfSubformControl is a container control on the main form. This

      control is where you set the Parent/Child links. The name of it may or may

      not be the same as the name of the subform itself.

      Wayne Morgan

      MS Access MVP

      "dalynn" <dalynn.ms-access.questionfor.info.discussions.microsoft.com> wrote in message

      news:65FC1F12-1453-4D00-9862-C6C78FC8F52D.ms-access.questionfor.info.microsoft.com...

      >I have a dsum calculation working in a form control (it totals the value of

      > orders for a customer). I have another working in a subform of the main

      > form

      > (totalling payments received for the same customer). I want to deduct the

      > payments received from the balance. How can I subtract one dsum amount

      > from

      > the other to achieve this. I have tried many different ways, but always

      > get

      > the syntax wrong (the dreaded "#error")!

      #1; Sat, 07 Jun 2008 20:02:00 GMT