Hi,
I am trying to use formula templates in my application
I have table with the formula templates for different scenarios. TableName = CorrRules. Each scenario has a scenarioID in this table. One of my formuala templates is
[ProbVar]&" == " & [ProbVal]. This is stored in the field Formula2Use
I have another table, TableName = Checks, which I need to use to create my desired output based on the formula templates. Each record in this table also has a scenarioID
I link the tables on ScenarioID and create the field
myformula: eval_mmm([formula2Use])
Eval_mmm() is a wraper function:
Public Function eval_mmm2(str2evaluate As string)
eval_mmm = Eval(QuotedStr(str2Evaluate))
End Function
QuotedStr is another wrapper function defined as follows:
Public Function QuotedStr(String2Quote) As String
QuotedStr = Chr(34) & String2Quote & Chr(34)
End Function
When I run this code I get MyFormula returning 0 (zero)
However when I write myformula as:
eval_mmm([ProbVar]&" == " & [ProbVal])
replace Formula2Use, the field holding my formula template, with the actual formula template it works!
Why does it fail in the first instance?
TIA
Clemens
I am trying to use formula templates in my application
I have table with the formula templates for different scenarios. TableName = CorrRules. Each scenario has a scenarioID in this table. One of my formuala templates is
[ProbVar]&" == " & [ProbVal]. This is stored in the field Formula2Use
I have another table, TableName = Checks, which I need to use to create my desired output based on the formula templates. Each record in this table also has a scenarioID
I link the tables on ScenarioID and create the field
myformula: eval_mmm([formula2Use])
Eval_mmm() is a wraper function:
Public Function eval_mmm2(str2evaluate As string)
eval_mmm = Eval(QuotedStr(str2Evaluate))
End Function
QuotedStr is another wrapper function defined as follows:
Public Function QuotedStr(String2Quote) As String
QuotedStr = Chr(34) & String2Quote & Chr(34)
End Function
When I run this code I get MyFormula returning 0 (zero)
However when I write myformula as:
eval_mmm([ProbVar]&" == " & [ProbVal])
replace Formula2Use, the field holding my formula template, with the actual formula template it works!
Why does it fail in the first instance?
TIA
Clemens