>Hi All,
>
>I have forms that run external from the main program. In the DE.Beforeopentables() of the form, I do a low level test using fopen() to check if all the files of the table are intact. Typically, if of the file is bad or missing (not uncommon), the table won't open and the form doesn't open. This is the way I do it, don't tell me to do it another way. Here's an example:
>
>local lnhandle,lcfilename,i
>
>for i=1 to 5
>
> do case
> case i=1
> if used(this.cursor8.alias)
> exit
> endif
> lcfilename=upper(gcdefault+"DATA\+this.cursor8.alias+".DBF")
> case i=2
> lcfilename=upper(gcdefault+"DATA\"+this.cursor8.alias+".FPT")
> case i=3
> lcfilename=upper(gcdefault+"DATA\"+this.cursor8.alias+".CDX")
> case i=4
> lcfilename=upper(gcdefault+"DATA\"+this.cursor9.alias+".DBF")
> case i=5
> lcfilename=upper(gcdefault+"DATA\"+this.cursor9.alias+".CDX")
> endcase
>
> lnhandle=fopen(lcfilename)
>
> if lnhandle>0
> fclose(lnhandle)
> else
> x3msgsvc("Unable to open document table",lcfilename)
> ?
> endif
>
>next i
>
>My problem is I can't seem to back out of the DE. It ignores Return (plain, .f.,.t., to whatever...), Unload, Destroy blah blah blah...
>It just continues into the Load event.
>The only thing that works is Return To Master, but in that case, it Quits.
>Any suggestions?
>
>Luke
One way: Do your test in the DE.BeforeOpenTables(). If it fails set the DataEnvironment.Tag value to something like 'Fail' then in the Form.Load():
IF THISFORM.DataEnvironment.Tag="Fail"
RETURN .F.
ENDIF