By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,965 Members | 2,043 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,965 IT Pros & Developers. It's quick & easy.

Eval Function

P: 1
Hi, Iím accountant by profession, so database development is a new field for me, but Iím very motivated.
Please let me know if anybody could explain what Eval function does and how to use it. Iíve read the help topic on MC site, but couldnít make sense of it.
Specifically, they donít explain how the syntax works.
Also, the logic behind this function is not clear. In other words: for what kind of problems it was created? Thanks in advance.
Sep 23 '08 #1
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,471
Eval is provided for where logic, or functionality needs to be derived from some sort of variable source.

Consider the following (I know this example can be done more easily without Eval() but simply as an illustration) :
You have an field ([TranType]) in a record that could evaluate to either of the strings "Invoice" or "Credit". Another field is [TranVal]. You need to determine the value of the transaction record within a query, so the following would be an option for you :
Expand|Select|Wrap|Line Numbers
  1. SELECT ...
  2.        Eval('[TranVal]*' & IIf([TranType]='Invoice','+','-') & '1') As [LineVal]
  3. FROM ...
Does this help?
Sep 23 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.