Albert,

If I understand your comment, during each loop, it will look at this
code and if the esc key has been used, it will break the while loop,
correct?

Will the rest of the code outside of the while loop then continue, or do
I need more code?

James Belisle
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Albert
Berry
Sent: Wednesday, May 11, 2011 10:11 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: cancel button within WHILE

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
>


Reply via email to