Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parametizing Dataenvironment?
Message
De
12/09/1997 15:32:53
 
 
À
12/09/1997 15:26:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00049913
Message ID:
00049915
Vues:
50
>Hello all,
>New to VFP - still struggling with the basics.
>
>I have a simple table maintenance form - a code and a description. Rather than create 15 practically identical forms for the 15 tables, I want to pass the name of the table as a parameter to a single generic form 'TableMaint' and load the table at runtime. (I also pass the form's caption).
>
>In TableMaint.init I have -
> THISFORM.tablename = lcTableName && parameter passed from menu
> THISFORM.grid1.recordsource=lcTableName
>
>In DataEnvironment.init -
> THIS.InitialSelectAlias = THISFORM.TableName
>
>In DataEnvironment.OpenTables
> DataEnvrionment::OpenTables
> USE (THISFORM.TableName)
>
>DataEnvironment.autoopen=.F.
>DataEnvironment.autoclose=.F.
>
>The form appears, the caption is set, but no table is loaded. It looks to me as if the DataEnvironment's init method executes before the form's so the tablename property hasn't been initialized yet.
>Should I set a global variable to the table's name before running the form? But I want to be able to run multiple instances of the form.
>What to do? All suggestions welcomed.
>
>Martin

If DE.AutoOpenTables=.f., you will never fire OpenTables you do it explicitly in code. There are meny ways to handle your situation. One of them is not to fight with DE, open all 15 tables, and in Form.Init event select appropriate table:
**** Form.Init event
Parameter cTablename
Select (cTablename)
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform