dsum

G

Guest

I want to display on an order form for each customer, a running total of
their spend and total days booked. The way I have tried to do it is to put a
text field on the form and in the control inserted the command
dsum=("cost_of_course",""orders","Customer_order_id=form.Customer_order_id")
where I thought the form.Customer_order_id would be the id displayed in the
box Customer_order_id on the form. It does not work! If I replace the
form.Customer_order_id with an actual value, it works for just that customer.
The display however is just numbers and loses the currrency formatting. Am
I approaching this the wrong way? Can anyone please suggest what I am doing
wrong, or an alternative method to sum the totals and get correct formatting?
 
A

Allen Browne

Concatenate the value of the text box on the form into the 3rd argument of
DSum(), i.e.:

=DSum("cost_of_course", "orders",
"Customer_order_id = " & [Customer_order_id])
 
G

Guest

Thanks for this. Is there any way I can preserve the formatting i.e if I am
summing currency and the total = £33,440.00, how can I get this to display
correctly.
 
G

Guest

Thanks for this. Is there anyway I can get the totals to display in the
correct format eg if the sum =£33,440.00, how can I display the total like
this.
 
G

Guest

Thanks for this. Is there anyway I can preserve the formatting in the text
box eg if sum =£33,440.00 how can display it like this?
 
A

Allen Browne

If this expression goes into the Control Source of a text box, just set the
Format property of the text box to:
Currency

If it's for a MsgBox, use the Format() function, i.e.:
=Format(DSum(...), "Currency")
 
G

Guest

Thank you.

Allen Browne said:
If this expression goes into the Control Source of a text box, just set the
Format property of the text box to:
Currency

If it's for a MsgBox, use the Format() function, i.e.:
=Format(DSum(...), "Currency")
 

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

Similar Threads


Top