> 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 ...")
CLEAR ALL
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.