Jim, you need to use the command BREAK to exit the while loop.

PAUSE FOR 8 USING '[Esc] to Cancel Printing'
SET VAR vLastKey = (LASTKEY(0))
IF vLastKey = '[Esc]' THEN
   BREAK
ENDIF

Albert
On 11/05/2011 9:07 AM, Jim Belisle wrote:

I have a process that after creating temp tables I use the cursor code to run a series of PDF files.

Sometimes things happen during the WHILE loop (printer jam, out of paper, or code interruption) where the user needs to cancel the rest of the print job.

What code would I use to give this option?

Here is the Cursor w/ WHILE loop code I use:

SET ERROR MESSAGE 705 OFF

DROP CURSOR c2

SET ERROR MESSAGE 705 ON

DECLARE c2 CURSOR FOR SELECT partnum FROM tpartpdf ORDER BY partnum

OPEN c2

FETCH c2 INTO vpdfnum INDICATOR ivpdfnum

WHILE SQLCODE <> 100 THEN

  PAUSE FOR 8

  PRINT partsheetpdf WHERE partnum = .vpdfnum AND +

  procused IN (y,f) ORDER BY partnum orderdone +

  OPTION PRINTER

  CLS

  FETCH c2 INTO vpdfnum INDICATOR ivpdfnum

ENDWHILE

DROP CURSOR c2

We use 7.6.

James Belisle


--- RBASE-L
================================================
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]

(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
================================================
TO UNSUBSCRIBE: Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
================================================
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body, place any text to search for.
================================================


Reply via email to