When do I use the IIf function?

G

gdwilliams11

Hello! I'm trying to build an IIf function. I have a column in a table
denoted Tax Payment. Next to it, I have a column denoted Tax Payment Amount
(field is currency). The Tax Payment criteria is set to yes or no. I want
to build a function that says if [Tax Payment] is yes, then [Tax Payment
Amount] can't be zero. I've built and IIf function that looks like this:
=IIf([Tax Payment]="yes", <>0, 0) and I keep getting an error message! Could
someone please tell me (1) if my function is built correctly and (2) can I
use this function in a table criterion or is it just for query's, forms,
etc...? If I can only use this in a query, how should I set up my query?
Thanks a bunch for all of the help!
 
K

KARL DEWEY

Where are you using this IIF statement?
It should be something like this in your form --
=IIf([Tax Payment]="yes", [Income] * .13, 0)
--OR--
=IIf([Tax Payment]="yes", [Income] * [Tax Table].[Percent]/100, 0)
 
L

Larry Linson

You can't refer to another Field in the Record, in the Validation Rule or
Default Value of a Field in the Table Design. You'll have to do this in a
Query, or on the Form where you enter the information, or on the Form or
Report where you refer to it.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top