IF Statement and Multiplication

meinpsl

New member
Local time
Today, 14:20
Joined
Jun 3, 2005
Messages
8
Hi
I need help creating a calculated field. I'm not sure how to write the IF statement.
Calculated Field Name: Special_Rate
Data Field Name: phrearn_earn_code
Bascially....
If phrearn_earn_code = OT1, then I need to Multiply OT1 * .5 for a total.

Thanks
 
Do you plan on doing this in the underlying query on directly on the form?
 
IF statment and Mutiplication

Hi Ken
It's in a Query.
THANK YOU!
 
Select IIf(phrearn_earn_code = OT1, OT1 * .5, ?what do you want to do if they are not equal?) As Calc1, fldA, fldB, etc.
From YourTable;

You need to provide an expression for the false case of the IIf().
 
Query using If and Multiplication

Hi Pat
I just want to multiply OT1 *.5 if earn_code is = OT1. Ignore all other codes in earn_code
 
It doesn't work that way. You have to specify what you want or the calculated field will be null when OT1 <> earn_code.
 
IIf(phrearn_earn_code = OT1, OT1 * .5, OT1)

(But this would only seem to work if phrearn_earn_code and OT1 are numeric values...)
(Or did I miss something?)
 
Last edited:
Query Multiplication

Sorry I confused everyone. :)

I'm retrieving more then just that one field. Also, Total_pay, but based on the earn_code of OT1. I think Pat answered my question.

Thank you everyone.
 

Users who are viewing this thread

Back
Top Bottom