RunningSum - TitleHeader

  • Thread starter Thread starter Rick Allison
  • Start date Start date
R

Rick Allison

I want to display the RunningSum in the TitleHeader. Anyone done this and can share what they did?

I created a text box, call it "A", in the detail section and gave it a control source of "=1" and a runningsum of "Over Group". I created another text box, call it "B", in the Title Footer and gave it a control source of the running sum text box "A". I then created yet another text box, call it "C", in the title header that is unbound.

I created "on print" code for the TitleFooter that populates the unbound text box "C" with the value of "B"
me!c = me!b.

It works almost.

If I have three groups this is what it displays
Group 1 TitleHeader RunningSum = 2
g1
g2
g3

Group 2 TitleHeader RunningSum = 3
g1
g2
g3
g4

Group 3 TitleHeader RunningSum = 4
g1
g2

Notice how it wraps. Group 1 displays groups 3's value, group 2 displays group 1 and group 3 displays group 2. Can it be done so group 1 shows the value "3", group 2 shows the value "4" and group 3 shows value "2"?

Thanks,
 
Rick said:
I want to display the RunningSum in the TitleHeader. Anyone done this and can share what they did?

I created a text box, call it "A", in the detail section and gave it a control source of "=1" and a runningsum of "Over Group". I created another text box, call it "B", in the Title Footer and gave it a control source of the running sum text box "A". I then created yet another text box, call it "C", in the title header that is unbound.

I created "on print" code for the TitleFooter that populates the unbound text box "C" with the value of "B"
me!c = me!b.

It works almost.

If I have three groups this is what it displays
Group 1 TitleHeader RunningSum = 2
g1
g2
g3

Group 2 TitleHeader RunningSum = 3
g1
g2
g3
g4

Group 3 TitleHeader RunningSum = 4
g1
g2

Notice how it wraps. Group 1 displays groups 3's value, group 2 displays group 1 and group 3 displays group 2. Can it be done so group 1 shows the value "3", group 2 shows the value "4" and group 3 shows value "2"?


That's to be expected since the code runs after the footer
value is calculated, thus you're setting the header value
for the next header.

I've noticed that, at least in A2002, just using an
expression in the header text box that refers to the footer
text box seems to do what you want.

If that doesn't work in your situation, you'll have to play
some games by forcing Access to format the report twice
using a Page of Pages kind of text box in the page
header/footer. You can then use a module level Collection
to save the value in the footer section's Format event so
the header section's event can retrieve the appropriate
saved value and set it text box's value. Be sure to guard
against the collection member not found error you'll get the
first time through.
 
Back
Top