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

No. of Pages in a Report 2

Status
Not open for further replies.

vdeveloper

Programmer
Joined
Aug 5, 2000
Messages
42
Location
IN
How do I determine the number of pages in a report form? I have reports where no. of lines and layout always vary depending on the data, so I cannot programmatically calculate the last page no everytime. I would like to print "Page : " xx of XXX in the page header. The _PEPAGE variable doesnt help.


Thanks in advance
 
GLOBAL gnLastPage = 0
REPO FORM XXXXXXX NOCONSOLE
gnLastPage = _PAGENO

* Now print for real, using gnLastPage WITH REAL PAGE No.
(_PageNo 'OF' gnLastPage) can be used in report form.
**
Hope this helps :)

ramani
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :-)
 
I want my report to end printing without ejecting page.
 
udaygour

May I suggest you start a new thread for your question. Since this is an old thread, your question may be overlooked. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Vdevelop,

Ramani's approach is closest to what you want, but doesn't work with pinpoint accuracy (I THINK it's because the noconsole option doesn't correctly interpret the page size on some printers).

The route I use is similar, set a global variable to zero, run the report to a preview - but stuff the keyboard with the command to go to the end of the report.

Put a function in the report (I put it near the bottom of each detail) which sets the global variable to be equal to _pageno each time a header is shown - if _pageno is greater that the variable.

Long winded and a bit messy I know, but it is reliable.


Code:
m.pages = 0
KEYBOARD "{ctrl+f12}{End}"
REPORT FORM XXXX PREVIEW

FUNCTION LAST_PAGE
	M.PAGES = IIF(_PAGENO>m.PAGES,_PAGENO,m.PAGES)
	RETURN("")

Regards

Griff
Keep [Smile]ing
 
udaygour,
Since I don't see that you've re-submitted this question, the no eject option really depends on which (if any) printer driver you are using. Normally, when a printer job closes, it will eject. This is because the print spooler may have another job queued up, and it may not be from the same source.

The good news is that VFP 8.0, will offer an option to chain reports together - you'll just have to wait for it - hopefully early next year.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top