problem calculating Sub Total

rvd48

Registered User.
Local time
Today, 14:46
Joined
Feb 2, 2004
Messages
123
i have a report which acts as a invoice, it displays the selected pc components and related prices for that customerID.


now, when i want to calculate the sub total, i have put this formula into a text box: =Sum(CLng([Quantity]*[UnitPrice]))

but i when go to view it in print preview mode, the box comes up with a #Error

i've tried this: =Sum(CLng([line total]))
(line total calculates the end price if more than one of the same component is used). it comes up with again: #Error

any idea's anyone? :confused:
 
rvd48 said:
i've tried this: =Sum(CLng([line total]))
(line total calculates the end price if more than one of the same component is used). it comes up with again: #Error

any idea's anyone? :confused:


Sounds like a missing Record Source. Do you have one set? Design view of the report.. Properties.. Data tab.. Is the appropriate Record Source entered?
 
I was able to duplicate your problem. Is the text box control in the footer?

You will get #Error if you are trying to do a calculation of fields in the detail section from outside the detail section.

Insert a text box (visible or not visible - your choice) in the detail section with the quantity and unit price fields. Name it txtSubTotal and set the control source to = [Quantity] * [UnitPrice]
and set the running sum property to Over Group or Over All, whichever you prefer.

Then in the footer, where I assume you want the total to appear, add a text box and set its control source to =CLng([txtSubTotal]).

That should do it.
 
thanks for that guys,

richo, you are right, i've done what you've suggested and it works a treat.
thanks :cool:
 
You will get #Error if you are trying to do a calculation of fields in the detail section from outside the detail section.
only if you use the Page Footer, you can Sum detailed records in Group and the Report footer
 

Users who are viewing this thread

Back
Top Bottom