Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Escape from dataenvironment..
Message
De
08/03/2011 11:03:09
 
 
À
08/03/2011 10:29:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01502909
Message ID:
01502917
Vues:
103
This message has been marked as the solution to the initial question of the thread.
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform