View Full Version : Simple question: totals in report footer?


andreas_udby
06-24-2002, 10:25 AM
Okay, I know this is probably the easiest thing on earth: I put a text box in the report footer that is supposed to total the results of a corresponding control in the details section. As per the Microsoft Help reference, I set the text box's datasource to the following:

=Sum([txtEx_Sales])

-- where "txtEx_Sales" is the name of the control in the detail section. Now, according to Help (yes, I truly am that naive), this should work, but when I try to run the report, I get a message box asking for the value of "txtEx_Sales." I've double-checked the name I put in the datasource of the text box, and it's correct. What am I doing wrong?

Thanks,
Andreas

fernin8r
06-24-2002, 10:33 AM
Try =DSum("[txtEx_Sales]","Table/Query", WHERE)

Pat Hartman
06-26-2002, 07:56 AM
The Sum() function can only reference columns of the report's recordsource. It cannot reference control names. Therefore, it should be:

=Sum([Ex_Sales])

If the control you were trying to reference was calculated, you'll need to repeat the calculation as in:

=Sum([Fld1] * [Fld2])

andreas_udby
06-26-2002, 08:37 AM
Ah... that does make sense. Now, when I calculated my contols in the Details section, I had to use the Nz function to avoid Null errors -- do I need to do the same inside the Sum function?

Alternatively, how else would I go about summing a set of calculated controls (all populated by the same fields, obviously) at the very end of a report? Any suggsestions?

Thanks,
Andreas