G
Guest
I would like to have the calculations I am performing on fields in a Pricing
table come from a calculations table (thus allowing me to extend the amount
of calculations I do on a pricing file by simply adding additional records in
the calculations table and not having to hard code them all in VB). In the
calculation table, I have a field called Calculations, when I pull the field
out via ADO, I am unable to get the result since I can’t seem to evaluate the
formula from the Calculations field since VB only see it as a string. For
example;
Table Schema’s:
Table Price
PriceField1 = 5.50
PriceField2 = 2.50
PriceField3 = 1.00
Table Calculation
CField1 = rcdPriceField1 – rcdPriceField2
CField2 = Max(rcdPriceField1, rcdPriceField2, rcdPriceField3)
VB Code (not working yet)
Dim curResult1 As Currency, curResult2 As Currency, curResult3 As Currency
‘ setup info and record opens
‘ADO objects
rcdPPrice.Open strSQL, cn, adOpenStatic, adLockReadOnly
rcdCalculation.Open "SELECT * FROM tblCalculation, cn, adOpenStatic,
adLockReadOnly
Do Until .EOF
‘ I wish to be able to have the cal pulled from the table then processed,
such as
curResult1 = rcdCalculation!CField1
curResult2 = rcdCalculation!CField2
curResult3 = rcdCalculation!CField3
rcdPPrice.MoveNext
‘ extra processing logic here
Loop
‘ clean up and exit.
' * * * * end code * * * * *
Any ideas on how I can load my calculations in a table, then pull them out
and have them executed in VB?
Thanks in advance for your assitance,
Mike P.s
table come from a calculations table (thus allowing me to extend the amount
of calculations I do on a pricing file by simply adding additional records in
the calculations table and not having to hard code them all in VB). In the
calculation table, I have a field called Calculations, when I pull the field
out via ADO, I am unable to get the result since I can’t seem to evaluate the
formula from the Calculations field since VB only see it as a string. For
example;
Table Schema’s:
Table Price
PriceField1 = 5.50
PriceField2 = 2.50
PriceField3 = 1.00
Table Calculation
CField1 = rcdPriceField1 – rcdPriceField2
CField2 = Max(rcdPriceField1, rcdPriceField2, rcdPriceField3)
VB Code (not working yet)
Dim curResult1 As Currency, curResult2 As Currency, curResult3 As Currency
‘ setup info and record opens
‘ADO objects
rcdPPrice.Open strSQL, cn, adOpenStatic, adLockReadOnly
rcdCalculation.Open "SELECT * FROM tblCalculation, cn, adOpenStatic,
adLockReadOnly
Do Until .EOF
‘ I wish to be able to have the cal pulled from the table then processed,
such as
curResult1 = rcdCalculation!CField1
curResult2 = rcdCalculation!CField2
curResult3 = rcdCalculation!CField3
rcdPPrice.MoveNext
‘ extra processing logic here
Loop
‘ clean up and exit.
' * * * * end code * * * * *
Any ideas on how I can load my calculations in a table, then pull them out
and have them executed in VB?
Thanks in advance for your assitance,
Mike P.s