Report events ...

M

M100C

All,
I have a report bound to a dataset that returns records like so:

ID, Value
1, 10
1, 7
1, 6
2, 12
2, 9
2, 2

I have a grouping footer (based on ID) with a textbox, which has a
controlsource of '=Max(Value)'. Because there are two unique ID's, there
are two footers, and the textbox in each footer has values of 10 and 12,
respectively.

I would like to have a textbox in the report footer with provides me an
average of these maximum values ... in the example above, the average would
be (10 + 12) / 2, or 11. Here is what I have done so far:

1) I am using the grouping footer OnPrint event to count and sum the values
in the textbox control, as the report runs. This event fires twice, and
results in setting public variables with the correct average.
2) Unfortunately, the controlsource property of the textbox in the report
footer is not exposed ... it appears that I cannot set it. I would have
assumed that I would be able to set this property from the report footer's
OnFormat event, but not so.

Any suggestions (w/o having to requery or step through the recordset ... I
know how to do this)?

M100C
 
D

Duane Hookom

Don't use code.

Create another "Max" text box in the group footer:
Name: txtMaxValue
Control Source: = max([value])
Running Sum: Over All
Visible: No
Create another text box in the group footer:
Name: txtCountGroup
Control Source: = 1
Running Sum: Over All
Visible: No
Create a text box in your report footer:
Control Source: =txtMaxValue/txtCountGroup
 

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

Top