How do I subtract one dsum amount from another

G

Guest

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")!
 
W

Wayne Morgan

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top