R
rwfreeman
I've declared 20 Public variables in the Declaration section of a
General module:
Public gCF1 as Double, gAFa as Double, etc.
These variables will contain values that are used in subsequent
calculations in the project and they represent default conditions.
However the user could elect to override one or all of them
temporarally and perform a non-default calculation. So my thought is
to assign values from the default table to public variables that could
be altered if the user chooses to do so.
Values for the variables are stored in a table that is queried to
create a recordset ("rst") that has a structure like so
rst.Fields(2) rst.Fields(3)
CF1 0.000001
AFa 0.2
so that the name of the variable is in .Fields(2) and its numeric
value is in .Fields(3). Thus, gCF1 should have a value of 0.000001
and gAFa should have a value of 0.2.
Looping through the recordset and using a SELECT CASE
rst.Fields(2).Value statement works but seems to me to be rather
inelegant and inflexible. If, instead of the SELECT CASE, I use a
statement such as
"g" & rst.Fields(2).Value = rst.Fields(3).Value
an compile error results ("Expected identifier or line number.")
FoxBase had a "macro substitution" (&VariableName=VariableValue) which
worked perfectly for this. What's the VBA equivalent?
Thanks for the help
General module:
Public gCF1 as Double, gAFa as Double, etc.
These variables will contain values that are used in subsequent
calculations in the project and they represent default conditions.
However the user could elect to override one or all of them
temporarally and perform a non-default calculation. So my thought is
to assign values from the default table to public variables that could
be altered if the user chooses to do so.
Values for the variables are stored in a table that is queried to
create a recordset ("rst") that has a structure like so
rst.Fields(2) rst.Fields(3)
CF1 0.000001
AFa 0.2
so that the name of the variable is in .Fields(2) and its numeric
value is in .Fields(3). Thus, gCF1 should have a value of 0.000001
and gAFa should have a value of 0.2.
Looping through the recordset and using a SELECT CASE
rst.Fields(2).Value statement works but seems to me to be rather
inelegant and inflexible. If, instead of the SELECT CASE, I use a
statement such as
"g" & rst.Fields(2).Value = rst.Fields(3).Value
an compile error results ("Expected identifier or line number.")
FoxBase had a "macro substitution" (&VariableName=VariableValue) which
worked perfectly for this. What's the VBA equivalent?
Thanks for the help