I haven't been following this thread 100% so forgive me if I'm confused on the problem. Are you saying that you call a UDF in your detail band that adds some totals to a variable or cursor or something and the problem is that as you jump through the report, the totals get messed up?
- First ... can you use Report variables instead of calling the UDF?
- Second ... If you can't use a report variable .. do this: Add a call to a UDF in the On Entry expression of the Title band of the report. In that UDF, clear the variables or cursors or whatever it is that you are building.
Whenever you go backwards through a report .. it actually starts over with the report and reprocesses everything from the beginning. Therefore, if you are only resetting your variables or cursor in a program before calling the report .. then as you preview through the report and skip backwards, the variables don't get reset. Adding a call to a UDF in the Title band ensures that the variables and/or cursor gets reset whenever you happen to go backwards through the report.
Cathy
>Hi Sergey:
>I suppose so. It rankles me that what is a relatively straight forward multi-level report without using the report designer is very messy when using it. It has become a case of the tail wagging the dog if I want to replicate the old report. In as much as maintainability of code is high on my prioirties I'm thinking of dumbing down the report to a level the report designer can handle without me having to stand the program on it's head.
>
>In this case it seems to be a case of how can I keep a UDF called on each line item from executing every time the line is displayed while previewing the report. Without setting all sorts of switches and comparing previous to current report control breaks I don't see any way to do this.
>
>Thanks for the feedback,
>Scott