Emmitt and Dennis,
Adding where limit = 1 to the pre-select helps a lot! However, does anyone know why the error variable is not setting. It does set if the select fails. But if the print command fails it does not. John From: [email protected] [mailto:[email protected]] On Behalf Of Emmitt Dove Sent: Friday, July 17, 2009 3:08 PM To: RBASE-L Mailing List Subject: [RBASE-L] - RE: Using the ERROR VARIABLE John, Use Dennis' elaboration of adding "where count = 1" and as soon as it finds one record the search will stop. Emmitt Dove Manager, Converting Applications Development Evergreen Packaging, Inc. [email protected] (203) 214-5683 m (203) 643-8022 o (203) 643-8086 f [email protected] From: [email protected] [mailto:[email protected]] On Behalf Of John Engwer Sent: Friday, July 17, 2009 2:55 PM To: RBASE-L Mailing List Subject: [RBASE-L] - RE: Using the ERROR VARIABLE Emmitt, That is how I have it working at the moment. This is a sliding search of a fairly large dataset. Sometimes the search takes a minute or longer to complete. I wanted to use the error variable to eliminate the overhead of the pre-select when matching records are found. A minute doesn't seem like a long period of time but when the operator is standing with a customer in front of the screen, it seems like an eternity. John From: [email protected] [mailto:[email protected]] On Behalf Of Emmitt Dove Sent: Friday, July 17, 2009 2:42 PM To: RBASE-L Mailing List Subject: [RBASE-L] - RE: Using the ERROR VARIABLE John , Why not do this: SELECT COUNT (*) INTO vcount FROM tablename WHERE .. Using the same WHERE clause as the report. Then test the variable vcount; if it is zero, there are no results, otherwise print the report. Note that you do NOT have to pre-define vcount, although it is recommended, and you do NOT need to use an indicator variable there. An aggregate function like COUNT will never return NULL. Emmitt Dove Manager, Converting Applications Development Evergreen Packaging, Inc. [email protected] (203) 214-5683 m (203) 643-8022 o (203) 643-8086 f [email protected] From: [email protected] [mailto:[email protected]] On Behalf Of John Engwer Sent: Friday, July 17, 2009 2:33 PM To: RBASE-L Mailing List Subject: [RBASE-L] - Using the ERROR VARIABLE I have run into a problem when I try to use the error variable to trap errors when printing a report. Here is what my code looks like. SET ERROR VARIABLE vErrVar Print report... where .. (if the where clause is not satisfied vErrVar should change to 2038) IF vErrVar <> 0 then Display message that no items exist.. ENDIF RETURN This is used to report the results of a search. If the operator enters search criteria where there is no match the operator should get a message that the search failed. If error messages are turned on, a 2038, no rows found is displayed but vErrVar has a value of 0 instead of the expected 2038. Does anyone know what I may be doing wrong? John

