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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get "page x of y" on a report

Reports

How to get "page x of y" on a report

by  Mike Gagnon  Posted    (Edited  )
Create a textbox in the footer of the report and put the following in it:
Code:
 'Page ' + ALLTRIM(STR(_PAGENO)) + ' of '+ ALLTRIM(STR(pnPages))

To print the report and get a page count you need to print it twice, once to a temporary file and the second time to the printer:
Code:
PRIVATE pnPages
LOCAL lcfile
lcFile = SYS(3)+".tmp"
lnHandle = FCREATE(lcFile)
FCLOSE (lnHandle)
WAIT WINDOW 'Calculating Page Count...' NOWAIT
REPORT FORM &cRepName TO FILE (m.lcfile) NOCONSOLE
ERASE (m.lcfile)
pnpages = _PAGENO
WAIT CLEAR
REPORT FORM &cRepName TO PRINTER PROMPT PREVIEW
RETURN
Mike Gagnon


Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top