• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 509
  • Last Modified:

How identify the max number in the detail section of a report and put iit in the footer of that group

I have a report that contains records in the detail section of the report.  In each record is a number field named "txtCount".  Then in the footer of that group I would like to have a field that has the max number from the "txtCount" number in the detail section.

In other words, if the detail records look like:

Field1          Count
Record 1     5
Record 2     7
Record 3     12
Record 4     4

Then the number I want to show in the footer is 12.

How can I do this?  What is the control source for the field in the footer?

--Steve
0
SteveL13
Asked:
SteveL13
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
=Max([Count])  should do the trick.

The other way is with a variable, which you use to populate a control, by:
it by:

1. Declaring a variable in the reports module (ie.  lngMaxCount as Long)

2. In the Group Header's OnFormat event, set that to -1

  lngMaxCount = -1

  Note that you can have the group header print, but with a height of 0 if you don't have one currently.

3.  In the Detail's OnFormat event, do:

   If Me![Count]> lngMaxCount then lngMaxCount = Me![Count]

4. Finially, in the Groups footer OnFormat event to:

     Me![<myControlName>] = lngMaxCount


Jim.
0
 
peter57rCommented:
Just add a textbox into the report footer with a controlsource of

=max([Count])
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now