View Full Version : IIf function


mjh
03-20-2002, 12:47 PM
I am attempting to add an IIf statement in my query. I have a field [TARE DATES] and would like to have each row of data show..
IIf [TARE DATE CHANGE1] less than #02/01/02# then leave blank but if [TARE DATE CHANGE1] is greater than #02/01/02# I want the value from the [TARE DATE CHANGE] field.

Please help me write this statement. This is what I have so far
Tare Date: IIf([TARE DATE CHANGE1]<=#2/1/02#,Null,IIf([TARE DATE CHANGE1]>=#2/1/02#,.....))

Thank you,

RV
03-20-2002, 01:08 PM
IIf([TARE DATE CHANGE1]
<#2/1/02#,Null,[TARE DATE CHANGE])

assuming both fields are part of one and the same table.

Suc6,

RV

mjh
03-20-2002, 01:21 PM
OK great, that worked, now her is the next
one. I have multiple TARE DATE CHANG.... fields and I want to continue this statement to include these other dates. Is it possible.

Tare Date: IIf([TARE DATE CHANGE1)]<#2/1/02#,Null,[TARE DATE CHANGE1],IIf ([TARE DATE CHANGE2)]<#2/1/02#,Null,[TARE DATE CHANGE2],IIf([TARE DATE CHANGE3)]<#2/1/02#,Null,[TARE DATE CHANGE3])))

Please advise. Your help is much appreciated

Pat Hartman
03-20-2002, 02:56 PM
You need to use a similar IIf() for each field, you cannot combine them. Remember, functions only return a single value.