General information
Category:
Forms & Form designer
Title:
Parametizing Dataenvironment?
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only