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!

A Simple Report 1

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
How do I limit a report to printing only 1 copy when the report contains only global variables.

When I call it with
Code:
I am calling it with REPORT FORM repname PREVIEW.
the page count just goes on forever.


Keith
 
Test for whatever you want
send the report to the printer with noeject to print
User will not get the chance to get more copies
Not sure if this is what your after but it does supress all print dialogues

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
I need to keep the preview dialogue but limit the output to one only copy. If I select print from the preview dialogue, it keeps printing reports until the trees run out.

Keith
 
Not trying to be a smart a__,

but, what if the user installed:
1-CutePDF printer driver
2-Made it as the default printer
3-Printed your report (One copy)
4-Made a PDF of it
5-Print as many as he wants now?

So, why force the user to print limit of 1?

there's many ways arround it.

Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
Since REPORT FORM relies on printing records from an underlying table, it's printing your report for every record in whatever table is currently selected.

Try using:
REPORT FORM repname NEXT 1 PREVIEW


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Maybe I am not naking the simple requirements of this report clear enough.
The scenario is this, within a complex application the user requires a function to print a simple estimate instead of his old method where he scribbled a figure on a scrap of paper.
Function
He selects the 'Estimate Button', two fields appear on screen, he puts words in the first section, an amount in the second section and then clicks the ok button.
A pretty estimate appears in form of the company letter head, the estimate, 'valid for 30 days' and all the usual stuff. He does not require copies of these estimates so at no time is a data table involved. The 2 variables are assigned to global vars and appear in the correct place on the report.
Select print from the preview dialogue and the estimate is printed out as required.
So far so good but here is where the problem arises.
Having printed out the required estimate, the printer keeps printing more copies until all the paper has gone and then asks for more.

Hence the original question,
How do I limit a report to printing only 1 copy.


Keith
 
Keith,

You need to make sure that the currently selected table/cursor contains exactly one record. For example, you could do this"

Code:
CREATE CURSOR Temp (Field1 C(1))
INSERT INTO Temp ("")
SELECT Temp
REPORT FORM MyReport

It doesn't make a scrap of difference what's in the cursor. It's the record count that determines how many times the report will repeat.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Hi Keith,

Your belief that "at no time is a data table involved" is just not true. Whatever table happens to be selected at the time you issue the REPORT FORM command will control the report. Use Mike's suggestion.

Jim
 
Thanks Dave, your suggestion of
Code:
REPORT FORM repname NEXT 1 PREVIEW
did the trick.
I missed your post but the problem is solved.

Mike
I see the logic in that but the NEXT option seems to be more efficient unless there is a problem I have yet to see.

Keith
 
Keith,

Just to add some further clarification ....

Your report is not really printing a large number of copies. There is only one copy. It's the detail band that's repeated. But since the detail band is only intended to appear once within each estimate, it will try to print many estimates ... or, to be exact, one estimate for each record in the underlying cursor. That's why the cursor has to contain exactly one record.

I'm not sure if I'm explaining it well. I hope it makes sense.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Keith,

Yes, NEXT 1 would work just as well, and is indeed simpler.

By the way - I've just been looking at the "rounded corners" demo on your website. Very interesting (but let's not veer off-topic).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top