Hi Steve,
Yes, this works just fine when previewing, even if you navigate back and forth between pages. Whenever you go to a preview page, the report writer actually starts over so the variable will get reset and recalculated properly.
What usually trips people up is that they put the incrementing code in the Group Header and not the Group Footer. In cases where the Group Header repeats on pages that overflow, the counter gets incremented a second time. That's where the trouble begins. This is why I always put the counter increment in the Group Footer because that only gets processed once for each Group regardless of how many pages the group stretched across.
Cathy
>Hello Cathy,
>
>But if you preview the report (and move up and down) this won't work, will it?
>
>What do you think of my other solution in this thread?
>
>>
>>Create a Report Variable called rnGroups, set the value to 0, and set it to SUM. (I know .. this doesn't sound right yet .. but trust me). In the OnExit Expression of the Group Footer band, put the following expression:
>>
>>
>>_VFP.SetVar('rnGroups', rnGroups+1)
>>
>>
>>Now at the end of the report you have the total number of groups processed.
>>
>>Cathy