April 30, 200619 yr Periodically I perform a find and get an error message that says: "no records match this set of find requests". [color:red]Is there a way to script an automatic selection of the CONTINUE button when this condition occurs? Thanks, Jarvis
April 30, 200619 yr There sure is ... Set Error Capture [ On ] ... then handle the error (or no records found) yourself (immediately after Perform Find), something like: If [ not Get (FoundCount) ] Show Custom Dialog [ "No Records Found" ] ... do whatever if no records found Exit Script or Halt Script (depending upon your needs and whether this is sub-script) End If ... work with found set LaRetta :wink2:
April 30, 200619 yr You want to turn on Set Error Capture sometime before the error occurs on the Perform Find to suppress the message. It automatically turns off when the script ends but you can turn it off with the same script step as well. Right after, and I mean the very next step after Perform Find since the error is only stored for one step after it occurs, use the If script step to test for the error. You don't have to but most people like to show a custom dialog that no records were found and also Show All Records. The condition you want to test for is "Get(LastError) = 401" or you can test for "Get(FoundCount) = 0". Either test will do the trick but Get(FoundCount) has the advantage of not needing to be tested immediately after Perform Find since it is not testing for the error number that is only held for a single step. Your find script might like look this: Set Error Capture [On] Enter Find Mode [Pause] Perform Find [] If [Get(LastError) = 401] Show All Records Show Custom Dialog ["Error"; "No records found"] End If Go to Layout ["MyLayout" (MyTable)] Find scripts can get a lot more complicated than this so if you want something better, look at a script on my web site called the Ultimate Find. You'll find the most recent version by searching for "DevCon 2005" in the Resources area. My web site is in my signature.
Create an account or sign in to comment