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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Math Library or EVAL() 1

Status
Not open for further replies.

jibberski

Programmer
Aug 24, 2005
52
US
Using VBA for an access 2003 sales app.

Does anybody know of an eval function, library, calc tool, algebra tie-in, or addin that will run 'if' statements? I have a large table of calculations that are used to get my total items count.

ie if(x=1,120,0)

I can parse this into variables (test,truepart,falsepart) or format it into proper VBA (if x=1 then 120 else 0 endif)

however some of the if statements are nested!! Recursion would be a pain.

Thanks for your help!
 
jibberski,
[tt]Eval()[/tt] won't do it?
Code:
? Eval("Iif(1=0,'Yes',Iif('Yes'='no','yes','no'))")
yes

CMP

(GMT-07:00) Mountain Time (US & Canada)
 

That was a huge help.

Eval won't run 'if' only 'IIF'.
 
jibberski,
Glad it helped, recursion sucks.

CMP

(GMT-07:00) Mountain Time (US & Canada)
 
If (pun intended) all of your statements are alike (or at least fall into a few recognizable patterns) it would be relatively easy to write a translator and generate the statements in a propper VB format. Then, you could use Eval(stmt) directly, or use any of severl alternative approaches, depending on wht the statements represent an how you are trying to use them.



MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top