Access 2010 Calculated Data Type Field in a Table Using IIF with EVAL

JasonTruman

Board Regular
Joined
Sep 30, 2003
Messages
85
Hey all

Am I right in asking that you cannot create an IIF statement using the EVAL function with AND for the new Calculated data type field in a table? It's telling me I cannot when I try to save the table design (the usual "Expression is not valid" etc). I'm able to do it in a query though

I thought the whole point of this new calculated field was to make our lives that much easier?

Cheers

Jason
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi,
What is the expression you are trying to use?
ξ
 
Upvote 0
IIf(Eval([MYFIELD1]= 1 And [MYFIELD2]>25000),[MYFIELD2]*0.0005,0) where MYFIELD are 2 of my fields from the table. As I said, it works fine in a query and also on a form, it doesn't like it in a Calculated Data Type field in a Table

I would just hope that if MS create a calculated field, you should be to able to perform all Access calculations that you can on a form or in a query
 
Upvote 0
You have to in Access when using IIF as you cannot evaluate 2 or more expressions as the logical_test without it. It's not like Excel where you use the AND function as the logical_test within the IF function. There is no AND function in Access as it is an Operator, hence why EVAL is used to tell Access to evaluate both expressions
 
Upvote 0
I agree that it would accept the formula, but the result is incorrect as you need EVAL for the AND operator (which is NOT a function remember), to work correctly
 
Upvote 0
Can you give an example that shows the result is incorrect? It should work. AND is a SQL operator.
ξ
 
Upvote 0

Forum statistics

Threads
1,221,626
Messages
6,160,909
Members
451,677
Latest member
michellehoddinott

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top