Doru,
As documented in VFP help, "Visual FoxPro performs two passes through the report" to get the number of pages in it (_pagetotal). It doesn't do that if _pagetotal doesn't appears anywhere in report. See '_PAGETOTAL System Variable' in help for details.
>For most of our reports we had the page number as a string returned from a program:
>Program 'page'
>
return 'Page: '+alltrim(str(_pageno,10))
>We used a program because we wanted a standard format, and because it was easier to type
page() than ,i.'Page: '+alltrim(str(_pageno,10)),/i., and, the main reason, because it is easier to change one program than hundreds of reports, so, recently I've changed the page() program to:
>
return transform(_PAGENO)+' of '+transform(_pagetotal)
>Easy it was, but it doesn't work! The _pagetotal is not seen in the report, so the value is not updated, and what we see is something like Page 1 of 1, 2 of 1, ... , 8 of 1...
>If I add a _pagetotal field, or a report variable that uses _pagetotal, it works, but I'd like to have this working without changing anything in the reports. It must be easy, I just can't see it...
>TIA
--sb--