Solved

# How make largest calculated value in detail section of report print in footer section

Posted on 2011-10-13
295 Views
I have a report that has a calculated number value in each record on the report.  In the footer section of the report I want to print the largest of the detail values.  Just the one largest value.  How can I do this?

--Steve
0
Question by:SteveL13

LVL 75

Expert Comment

Assuming the calculation in the the query driving the report, create a text box in the Footer

Control Source:

=DMax([YourCalcFieldName])

mx
0

LVL 119

Expert Comment

you can try dmax with a domain

=dmax("[calculatedfield]","queryName")

"queryName" is the name of the Record Source of the report
0

Author Comment

The first suggestion does not work.  The second one only gives me the last calculated value from the detail section.
0

LVL 75

Expert Comment

And actually, make the Control Source of the text box

=Max([YourCalcFieldName])

not DMax()

And using the method will take into account any filtering that may occur when the report open.  Getting DMax() from the query will not.

mx
0

LVL 119

Expert Comment

how do you do the calculation ?
0

LVL 75

Expert Comment

SteveL13:  try my post @ http:#a36965549

mx
0

LVL 47

Expert Comment

is this a continuous form, or a single form?
0

LVL 75

Expert Comment

It's a report ...
0

LVL 26

Accepted Solution

Me being me, I'd code it

Public TheBiggest as Single 'or double or integer or whatever

Then in the ReportOpen()
TheBiggest=0

Then in the Detail_Format()
if WhateverYouAreCalculating > TheBiggest then
TheBiggest = WhateverYouAreCalculating
end if

And finally in whatever section you want to display it
Me.SomeControlValue = TheBiggest

You might be able to muck with some control value to get it to work--and that might be more elegant.
This will work, and you can understand how it works--which is why I'd do it this way
0

Author Closing Comment

This worked perfectly.  Thanks.
0