Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a formula from a field

Status
Not open for further replies.

jkafer

Technical User
Feb 13, 2004
32
US
I have a table with 30 rows of data, 2 fields.
This table will connect to another table on 1 field, the second field contains the formula that I want to run on the fields of the other table.

How do you 'activate' the formula that is in the field.

The reason for doing this is that an iif statement would be too long, and I thought this would be an easier manner to implement all of these conditions.

Any other ideas are greatly appreciated.
 
Sure.
This is an example of the table with the formulas.
fldCon fldFormula
A [fldOne]*[fldTwo]+[fldThree]
B [fldOne]+[fldTwo]+[fldFive]
C [fldOne]+[fldTwo]+[fldThree]

~~~~~~~~~~~
Column 1 is the linking item
Column 2 is an example formula

fldCon, fldOne, fldTwo, fldThree, fldFive are fields in the other table.
~~~~~~~~~~~
What I would like to do is link the tables, then execute the formula in the fldFormula
 
I don't know of a quick method to convert into an actual formula.

I would start by writing a function that read the string and picked out the fields and the operators as you move along, which is simple if the formula's are as simple as the one posted.

Maybe substitute the fieldnames for numbers and pass the recordset to the function,then you could index the fields directly.




Hope this helps!

Regards

BuilderSpec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top