Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Quit an Application
Message
From
11/01/2003 16:35:20
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
 
To
11/01/2003 15:57:08
John Tomblin
Service Station Systems, Inc.
San Jose, California, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00740696
Message ID:
00740702
Views:
27
> on error do GiveUp
> open database MyData shared
>
> *------------------------------------------------
> procedure GiveUp
>
> =MessageBox("Helpful Hints ...")
> close all
> clear all
> quit
> cancel
> return
>
>All I want to do is to display a message and terminate.When the database cannot be opened, the messagebox does appear but, the application continues to run and produce error after error.

I tested this with the following code:
SET STEP ON 

ON ERROR DO GiveUp
USE c:\NoFile
MESSAGEBOX("Got here")

*------------------------------------------------
PROCEDURE GiveUp

MESSAGEBOX("Helpful Hints ...")
*CLOSE ALL
CLEAR ALL
*QUIT
CANCEL
RETURN
The "Got here" box came up once while the VFP8 Toolbox was closing (CLEAR ALL). I found the following in the ON ERROR Help:
"Specifies the Microsoft Visual FoxPro command to execute. After the command executes, program execution resumes on the line immediately following the line that caused the error...ON ERROR procedures cannot be nested. If ON ERROR is issued within an ON ERROR procedure, the default Visual FoxPro error handler is restored."

I wonder if somehow you are getting a second error - maybe in the CLEAR ALL - ane triggering the default VFP error handler which somehow takes you back up to the code following your database opening code. I've seen odd things happen when you hit an error inside an error routine.
Previous
Reply
Map
View

Click here to load this message in the networking platform