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

Some reports are printed twice

Status
Not open for further replies.

k2a

Programmer
Jun 26, 2012
133
DE
Some of my reports will be printed two times and I cannot find why. Usually my print statements look like this:

lcReportSelect = ThisForm.fm_ReportSelector(vp_bktyp)
REPORT FORM reports\&lcReportSelect TO PRINTER NOCONSOLE

Because these commands are correct, so the problem must be somewhere within my report but could not find it.

Has anyone an idea?

Thanks a lot
 
One possibility is that the number of copies has been set in the printer environment.

To check this, do the following:

1. Open the report in the report designer.

2. In the Report menu, look to see if there is a tick against Printer Environment. If there is, remove it.

3. Still in the report designer, go to File / Print. In the printer dialogue, make sure the number of copies is set to 1; if necessary, alter it, then click Apply.

4. Close and save the report.

Let us know if that solves the problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Another less probable possibility is the code in fm_ReportSelector(vp_bktyp) is not only selecting, but also executing a report.
You get the whole truth, if you single step through your code in the debugger.

Bye, Olaf.
 
Another less probable possibility is the code in fm_ReportSelector(vp_bktyp) is not only selecting, but also executing a report.

And that reminds me that the best way to solve these problems is to eliminate each of the variables in turn. So with reference to the above, you would eliminate the first line of the code you posted, and the hard-code the report name in the second line.

Going further, you would try running the report from the command window (to eliminate any side-effects of your application), and then to run it from within the report designer.

I'm not saying you should do the above in order to directly solve the problem, but rather try each possibility in turn, to try to isolate the cause.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike
File / Print in the printer dialogue, the number of copies is set to 1
>> 2. In the Report menu, look to see if there is a tick against Printer Environment. If there is, remove it.

Do not quite understand what you mean here. Do you mean the Report Properties?

Olaf
I single stepped through it but the report is executing only once but printed twice.

When I do the following:
lcReportSelect = ThisForm.fm_ReportSelector(vp_bktyp)
REPORT FORM reports\&lcReportSelect Preview

The report appears on the screen but just as one page! Than when hitting the print icon on the Print Preview window two pages are printed.

Very strange.

Klaus
 
Does only that report print twice?
Have you checked printer settings?
Have you tried some of Mikes othe suggestions?
What about the data? Do you have double data?

Bye, Olaf.
 
Browse your report table (.FRX) and make sure the memo or memo2 fields don't have COPIES=2 or something similar in them. Mikes suggestion of clearing the environment tick should fix that, but who knows.
Also make sure the printer driver itself don't have 2 copies set somewhere either.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
REPORT FORM reports\&lcReportSelect Preview

The report appears on the screen but just as one page! Than when hitting the print icon on the Print Preview window two pages are printed.

You've just described exactly what I'd expect from REPORT FORM ... PREVIEW.

If you don't want the preview, don't add the PREVIEW clause.
 
>If you don't want the preview, don't add the PREVIEW clause.

That's not the problem. The preview shows one page, the output two.
Well, the preview always shows the first page, the preview toolbar enables you to navigate. Perhaps therr is no problem at all.

Bye, Olaf.

 
Avoid issuing the REPORT FORM command, from objects like grid.
If the cursor displayed by the report have only one record, and grid cursor have two, you will see this behavior.

Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
 
In the Report menu, look to see if there is a tick against Printer Environment. If there is, remove it.

Do not quite understand what you mean here. Do you mean the Report Properties?

No, I mean the Report menu.

Open the report in the Report Designer. Then open the Report menu (at the top of the screen). Look at the 6th item. It says "Printer Environment" (without the quotes). Is there a tick against it? If so, click on that same item to remove the tick.

(I'm assuming you are using VFP 9.0. If not, see Dave Summers' post above.)

More importantly, you should also try printing the report from within the report designer. (Go to File / Print, or click the printer icon on the toolbar.) If two copies get printed, that will tell you that the problem is in the report itself. If not, the problem is in your application.

Also check the underlying cursor or table. Open it in a Browse window, and check to make sure the data doesn't appear twice.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
You might try checking that the right number of records have been put into the cursor (or whatever)
that the report is running against - in case you have doubled it up?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
Mike
I removed the tick from the "Printer Environment" but this did not fix it.

Fact is that my problem must be sitting within the report itself, because I run other reports with the same application codes and those reports just print one page.

Also run the faulty reports from the command window and they keep printing two pages.

Then browsed through the report tables (.FRX) and comparing both the good and bad once.
The good report has 40 records and the memo field Expr has this content:
DRIVER=winspool
DEVICE=HP LaserJet 4 Plus
OUTPUT=LPT1:
ORIENTATION=0
PAPERSIZE=9
ASCII=0
COPIES=1
DEFAULTSOURCE=15
PRINTQUALITY=600
COLOR=1
DUPLEX=1
YRESOLUTION=600
TTOPTION=3
COLLATE=1

The faulty report has 30 records and the memo field Expr has only this in it:
ORIENTATION=0
PAPERSIZE=9
COLOR=1

I changed the memo field Expr content with the one of good report but it still keeps printing 2 pages.
This problem realy turns me crasy.

Thank you all for trying to help me!

Klaus
 
I changed the memo field Expr content with the one of good report but it still keeps printing 2 pages.

Did you also delete the contents of the Tag and Tag2 fields (in the same record)? One or both of those contain the compiled version of the Expr field, and you need to clear them to force the Expr to recompile.

Also, did you check the underlying cursor or table (the one that drives the report)? If, for some reason, it contained twice as many records as expected, that would explain the behaviour you are seeing.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Again: Have you checked printer settings?
The printer itself can be configured to print copies.

Bye, Olaf.
 

Mike
>> Also, did you check the underlying cursor or table (the one that drives the report)? If, for some reason, it contained twice as many records as expected, that would explain the behaviour you are seeing.

Thank you for that successful advice. My underlying cursor for the report contained indeed twice as many records.

Shame and blame on me!

Thanks all of you for your great help.

Klaus

 
Klaus,

I'm delighted you managed to solve the problem .... eventually.

But I have to point out that, several posts ago, Olaf, Griff and myself all suggested that you check the number of records in the underlying cursor. It's a pity you didn't do that when we first suggested it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Yes Mike you are absolutely right, after reviewing all the received posts.

Thanks again and sorry for keeping you busy.

Klaus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top