Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Page Number

Status
Not open for further replies.

RTorrance

Programmer
Apr 12, 2002
64
CA
Hello
I thought that there was a thread on this topic already but couldn't find it.

Is there a was to show pagenum of totalpages on a report?

Thanks
 
RTorrance

Take a look at faq814-2911, or serach on the Microsoft knowledge base where they suggest another solution, that doesn't involve printing the report to a temp file.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Or if you are using VFP 8.0, this is "native" - just use the system variable _pagetotal. Note: VFP 8.0 effectively does the same thing as the FAQ does, it's just hidden from you. Therrefore the normal warnings about updating any data in running the report still apply (i.e. it'll actually happen twice!).

Rick


Rick
 
You can do it like this
Create a variable named 'nTotalPages' for example and put it in your Report

Public nTotalPages
REPORT FORM Myreport.Frx NOCONSOLE
nTotalPages = _pageno
REPORT ForM Myreport.Frx 'Preview' or 'To Printer' ...

when you print your report the 2nd time to Preview or to file or to printer as you like you will have the total number of pages in the variable nTotalPages.
 
I tried both of the suggestions and each time I ran it it would come back with page 1 of 1, page 2 of 1, page 3 of 1 and so on. If there are any more suggestions they would be greatly appreciated.
Thanks
 
It would seem you are missing the point that the report expression would use some thing like:
"page "+alltrim(str(_pageno))+" of "+alltrim(str( nTotalPages))

Rick
 
No, i have all of what was posted. It seems to me as though nTotalPages is not being set properly.
 
RTorrance

No, i have all of what was posted. It seems to me as though nTotalPages is not being set properly.

Are you refering to the solutions proposed by Shevshenko, or the faq I pointed to? The solution suggested by Shevshenko is know under certain circumstances to report a wrong total page number.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I am refering to what Shevshenko posted. I also tried what was posted in the faq and it showed the same reults.
 

RTorrance,

It seems to me as though nTotalPages is not being set properly

Just curious. Did you check the value of _pageno ?
Can you try this ?

REPORT FORM Myreport.Frx NOCONSOLE
Wait 'pages: ' + transform(_pageno) window

-- AirCon --
 
I used this in all my reports and it works correctly.
I put this in the valid event of the command button that prints the reports.
 
The value of _pageno is always 1. I have this piece of code in the valid event of the command button.
 
In this case I have no idea what's wrong with it.

How about calculate the total page yourself. I mean like count the record to print and divide it by how many details for one page. I think you can work it out.

Btw in VFP8 there is a new System Variable for this purpose: _PageTotal


-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top