>>Is there a variable available that calculates the total number of pages in a report before page 1 prints?
>
>The only way I have seen this done is to print the report to a file and store the _PAGENO to a variable you can now use in the second printing of a report.
No, In Knowledge Base, there is a message to show how to make "Page x OF n" in another method..
If you use
View for report printing, join all table what you need, add any calculated field such as rowtotal...
Then the following Formula will be very useful for you!!
TotalPage = CEILING(RECCOUNT()/number_of_detail_record_per_page)Since in most case you seldom change the detail brand height or header height....
The
number of detail record per page can be determinated by sample try!!
For example, you found that there is 12 detail record per page..
Then, TotalPage will be
CEILING(RECCOUNT()/12)So, to make "Page x OF n" will be:
[Page ] + alltrim(str(_pageno)) + [ OF ] + Alltrim(Str(CEILING(RECCOUNT()/12)))The only pre-cause is that when printing last page, it will ask you
twice if you simply use :
Where ... MainKey = ?prtMainKey
You can simply set a PUBLIC or Form New Property to do it....
It will work perfectly!!
Moreover, Using
View for printing allow you
Set Delete ON to skip deleted record,
and thus RECCOUNT() will NOT return wrong value! ^_^;
For more information about comparsion of printing twice and use formula, see KB!
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.