>>Not knowing what's a greenbar (I imagine it as a salad bar :) I can only suggest a separate function and a separate variable for each band, or the same function with different parameters, so it would check for the recno() in the detail, and the group expression in group bands.
>
>Dragan,
>
>I tried the same function with different parameters for each band, but I had inconsitant results. That is why I started tracking where the calls were coming from with a Wait Window in my function.
>
>FYI, the greenbar effect is kind of a throwback to the old computer paper which had alternating green and white bars. It can be very helpful when you are looking at many rows on a printed report. You can simulate this effect with a shaded rectangle on the report.
Ah, the old pyjama paper. Well, the principle still holds - have a variable for each band to hold the band expression - a copy of recno() for detail, copy of group expression for each group band, and eof() for the grand total, and compare each time. If it's changed, it's the first call for that band; store the new value to the variable, and do whatever you want.
While the PrintWhen expressions may be evaluated many times (seems to be it recalculates to make sure the line would be blank, if you have "eliminate blank lines" set on), I think the OnEntry expressions would be calculated only once. You could have a separate set of logical variables in the report, set them from OnEntry functions, and have these variables as PrintWhen expressions. Thus you'd calculate only once, and you won't care how many times Fox looks at these variables.