Thanks Razzak, it worked perfectly, just what I needed. Dennis Hodges Maintenance Management Manager FDOT Office of Maintenance MS #52 PH: (850) 410-5635 FAX: (850) 410-5511 [email protected]
"Life doesn't have a remote, get up and change yourself." Please note: e-mail may be subject to public disclosure. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of A. Razzak Memon Sent: Friday, December 18, 2015 9:06 AM To: Hodges, Dennis Subject: [RBASE-L] - Re: Error trapping on Print command At 08:51 AM 12/18/2015, Hodges, Dennis wrote: >In the following print command if the where command returns no records, >the value of holder is 0, but I get a 2059 error message. How can I >trap this error? > >SET ERROR VARIABLE verrvar > PRINT needfile ORDER BY site WHERE datecomp IS NULL AND ((crew1 = .zcrew) + > OR (crew2 = .zcrew) + > OR (crew3 = .zcrew) + > OR (crew4 = .zcrew)) + > OPTION SCREEN|WINDOW_STATE MAXIMIZED + > |ZOOM_TYPE percentage 98 > set var holderr = .verrvar Dennis, Here is the best approach to handle such circumstances ... -- Start here ... SET VAR vRows INTEGER = 0 SELECT COUNT(*) INTO vRows INDIC iv1 FROM reporttablename + WHERE datecomp IS NULL AND ((crew1 = .zcrew) + OR (crew2 = .zcrew) + OR (crew3 = .zcrew) + OR (crew4 = .zcrew)) IF vRows = 0 THEN CLS PAUSE 2 USING 'No qualifying records to print this report' + CAPTION 'Print Report' ICON WARNING + BUTTON 'Press any key to continue ...' + OPTION BACK_COLOR WHITE + |MESSAGE_FONT_NAME Tahoma + |MESSAGE_FONT_COLOR RED + |MESSAGE_FONT_SIZE 11 GOTO Done ENDIF CLS PRINT needfile ORDER BY site WHERE datecomp IS NULL AND ((crew1 = .zcrew) + OR (crew2 = .zcrew) + OR (crew3 = .zcrew) + OR (crew4 = .zcrew)) + OPTION SCREEN|WINDOW_STATE MAXIMIZED + |ZOOM_TYPE percentage 98 LABEL Done CLS CLEAR VARIABLES iv%,vRows RETURN -- End here ... Hope that helps! Very Best R:egards, Razzak

