View Full Version : If statement in Query


fenhow
11-09-2009, 09:04 AM
Hi,

I have a query that runs a sum value based on a group.

in the same query I take that value and multiply it by 20 to get a number.

Table Calc Payout: Sum([si_Total_Surface_Tract_Acres]*20)
It works great!

What I am trying to do is if the total of the sum value is less than <1.25 then show a fixed number 25. Not the calculated value.

Is there anyway to do this in the query expression? I am trying this but it will not work.

IIf([si_Total_Surface_Tract_Acres]<2,"25.00")

Thanks.

Fen How

ajetrumpet
11-09-2009, 09:20 AM
put the calced field in the expression sir:iif(sum(field * 20) < 1.25, 25, sum(field * 20))

fenhow
11-09-2009, 09:33 AM
Thanks, that looks real good, I am getting a data type mismatch error? So close..

fenhow
11-09-2009, 10:01 AM
Adam, Nice to hear from you.

Thanks for you help.

This is what worked.

IIf(Sum([si_Total_Surface_Tract_Acres])<1,25,Sum([si_Total_Surface_Tract_Acres]*20))