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

How to know when printing a report is success

Status
Not open for further replies.

vhad

Programmer
May 27, 2001
26
ID
Dear All,

How to know when printing a report with command REPORT FORM ... TO PRINTER... is success or failed ?


Thanks in advance,
 
vhad

You may want to consider applying the suggestion in faq184-2919 to your situation. I returns a variable (.t. or .f.) wether the user pressed the print button in the report preview mode, but it can also be used in the straight to print mode. Although this will not tell you if the printer is out of paper, or that the computer didn't crash during the print job etc... Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
If your purpose is to find out if the printer correctly produced all the pages from the report, you have to ask the user. Use a MESSAGEBOX() after the REPORT FORM ... TO PRINTER that asks "Did the report print correctly?" or "Do you wish to print the report again?" and respond to the answer accordingly.

If the report runs unattended, there really isn't a way to find out if the printer messed up the report or ran out of paper. Mike Krausnick
 
Yes.
I want to prevent user to print the report twice.
So when the printer is offline or run out of paper, when user click print button, the program do not set the report as already printed.

Asking the user, maybe the best conclusion.

Thanks.
 
Why not check the status of the printer instead?
Maybe something like:

STORE .F. TO lContinue
ON ERROR PrtError()
SET PRINTER TO ......
ON ERROR

IF !lContinue
RETURN
ENDIF

IF SYS(13) = 'ONLINE'
REPORT FORM .....
ELSE
WAIT WINDOW 'Problem with the printer'
ENDIF


FUNCTION PrtError
STORE MessageBox('Printer troubles', 21, 'Ooops') TO nAnswer
IF nAnswer = 4 &&... retry
lContinue = .T.
ELSE
lContinue = .F.
ENDIF
RETURN
Dave S.
[cheers]
 
Dave,
Two problems:
1) SYS(13) can only return "OFFLINE" or "READY"
2) SYS(13) ALWAYS returns "READY" in VFP!

Rick :)
 
Rick,

I could be mistaken, but I thought SYS(13) was actually somewhat useful. I knew PRINTSTATUS() was worthless, as in your scenario but I thought SYS(13) returned online or not as long as it was connected directly to the paralell port and not networked.

Anyway, setting the printer to print directly to the port rather than spooling is a more sure way of getting an error if the printer is not working.
Dave S.
[cheers]
 
Dave,
I don't believe so. I just set my printer to a local empty port:
Code:
SET PRINTER TO NAME "Epson FX-80"
?PRINTSTATUS() && Reurns .T.
?SYS(13)  && Returns "READY"
But, if I try to print something there I'll eventually get a timed out error message from Windows.

(I tried this under VFP 6/7/8 under XP Pro and 98 SE.)

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top