rmoreno
03-17-2008, 05:17 PM
I have a report that has a calculated field in a group footer. I would like to reference the value of this calculated field in the group header. When I try to reference this field, using its control name, in the header I get the wrong value. Is there something special I need to be doing to get the correct value.
Almost forgot to mention. The Group Footer control is calculated using Code.
Thank you in advance.
ajetrumpet
03-17-2008, 05:38 PM
When does the "calculation" code run? When do you issue the reference command? Has the value been populated in the footer before the ref. command is issued? Make sure these two activities run in the correct order first...
Do you have a report event that triggers either of these events?
rmoreno
03-17-2008, 06:07 PM
The Group Footer control is calculated after the data detail has fully run. This activity seems to work fine. However, when I try to reference this control in the Group Header, I get a value of 1. How would I trigger an update to the Header control after the Footer control has been calculated?
ajetrumpet
03-17-2008, 06:20 PM
The Group Footer control is calculated after the data detail has fully run. This activity seems to work fine. However, when I try to reference this control in the Group Header, I get a value of 1. How would I trigger an update to the Header control after the Footer control has been calculated?You should just be able to reference it.
What's the code for the footer calculation? And what's the reference code?
rmoreno
03-17-2008, 06:39 PM
Here is a zipped copy of the Group Footer control calculations. I copied the original code into a Word document. How would I trigger an update to the Header control after the Footer control has finished calculating its value?
ajetrumpet
03-17-2008, 07:09 PM
Here is what I see:
** You have 3 subroutines, which means you have 3 events that fire code.
** You have no function CALLS in your subroutines.
** 3 of your controls are set to the value of "1" at some point
** Group Headers 0 & 1 have On Format events.
Maybe the last point I have made is the problem. Maybe, when you change an actual value in a control in the header section, the program considers that to be a format change. Could that be possible, I wonder??
rmoreno
03-17-2008, 07:17 PM
All very valid points. How do you suggest I resolve this problem? I tried referencing the Group Footer control in the Report Header but got the same results as I did when I tried to put the control reference in the Group Header. You mentioned control triggering events. How would I trigger the Group Header control to update after the Group Footer control has finished calculating?
ajetrumpet
03-17-2008, 09:15 PM
Moreno,
I am pretty convinced that the problem lies in the ordering of events. Obviously, the control in the group footer has a value of "1" when you reference it. And, you have 3 subs that set values of various controls to "1". I really can't tell you much more here, because you haven't given me any details about what the sequence order of all of procedures are...
I really feel like I am shooting in the dark. If you want a "guess", put a button on your form, and write something like the following on the click event:me.GroupHeaderControl = me.FooterControlReferencing between controls, regardless of their location on the report, should be that easy...
If you are still getting a value of "1" when doing that, then something else is comming into play here (if your report is not already corrupt, which I don't think it would be).