Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Beforeopentables and returning .f.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00944089
Message ID:
00944190
Vues:
8
Perfect Cathy. Thanks! I had tried a form property but I didn't have the sequence correct to set it and check for it. Now it is working great. However, just curious, but is there a way to check for the existence of a table without knowing its actual filename? Sort of like when you reference the recordsource of a grid:
IF USED(thisform.grdletter.recordsource)
   SELECT (thisform.grdletter.recordsource)
ELSE
   WAIT WINDOW "Cannot select table." NOWAIT
ENDIF
I would like to be able to check for the existence of the table without knowing the actual filename referencing the cursor property in the dataenvironment or maybe step through all of the cursors in the dataenvironment and ensure they exist before instantiating the form.

>Give this a try:
>
>- Add a property called lAbort and set it to .t.
>
>- In the Load method, add this code:
>
>DODEFAULT()
>IF ThisForm.lAbort
>  RETURN .f.
>ENDIF
>
>
>- In the Data Environment OpenTables method, add this code:
>
>NODEFAULT
>IF FILE('JUNKX.DBF')
>  DODEFAULT()
>ELSE
>  ThisForm.lAbort = .t.
>ENDIF
>
>
>
>>Typically I open the tables manually in a form's load (close them in the form's unload) and return .f. if the tables do not exist, etc so the form never loads, but:
>>
>>When autoopentables is .T. and the dataenvironment is used to open/close tables:
>>
>>is there was a way to cancel the form's load if a table does not exist by checking for its existance in the beforeopentables event of the dataenvironment? I have tried this by returning .f. but it appears that the data environment still attempts to open the form and returns the failure to instantiate object error message and then fails to load the form.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform