Dsum

S

Simon

I am trying to have a button on my order form that will work out how
much is outstanding on the order

on the form i have the total value of the the order and also have text
box that i want to dispaly the remaning amount.

I store all the payments in a subform.

The code i use works apart from when no payments are in the subform,
How can i change the code to make it work



RemainingToPay = Total - DSum("[Amount]", "tblPayments", "[OrderNumber]
= Forms![frmOrder]!OrderNumber.Value")
 
A

Allen Browne

1. Open the subform in design view.

2. If you don't see a Form Footer section, click Form Header/Footer on the
View menu.

3. In the Form Footer section, add a text box with these properties:
Control Source =Sum([Amount])
Format Currency
Name txtSumAmount

4. Save and close the subform.

5. Open the main form in design view.

6. Add a text box with Control Source of:
= [Total] - [Sub1].[Form]![txtSumAmount]
substituting the name of your subform for Sub1.
 

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