IF Statements - JCW

J

JohnW

I am trying to use a IF statement in a query field(MultiClassCalc) to assign
a value to that field. There are two variables, if a field(MultiClassDisc)
equals .10 or if the field(MultiClassDisc) equals 0. I have used the
following If statement to get the correct value if the field equals .10 but I
don't know what to use in the expression to get the value of MultiClassCalc
to be 0.

MultiClassCalc: IIf(ECG!MultiClassDisc=0.1,ECG!Tuition*0.1)
 
J

John Spencer

If you want either Tuition times .1 or 0

MultiClassCalc: IIf(ECG!MultiClassDisc=0.1,ECG!Tuition*0.1,0)

or if you want some other value(s)

MultiClassCalc: IIf(ECG!MultiClassDisc=0.1,ECG!Tuition*0.1,
IIF(ECG!MultiClassDisc=0,<<something>>, <<Else something else>>))
--
--

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
J

JohnW

thanks for this....it worked.....
--
JCW


John Spencer said:
If you want either Tuition times .1 or 0

MultiClassCalc: IIf(ECG!MultiClassDisc=0.1,ECG!Tuition*0.1,0)

or if you want some other value(s)

MultiClassCalc: IIf(ECG!MultiClassDisc=0.1,ECG!Tuition*0.1,
IIF(ECG!MultiClassDisc=0,<<something>>, <<Else something else>>))
--
--

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
J

JohnW

thank you....this worked perfectly.....
--
JCW


June7 via AccessMonster.com said:
Need the value if condition is not true (should get error message if not
provided):
MultiClassCalc: IIf(ECG!MultiClassDisc=0.1,ECG!Tuition*0.1, 0)

To calculate for each record regardless of discount and to return 0 if Null:

MultiClassCalc: nz(ECG!MultiClassDisc,0)*ECG!Tuition)
 

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