UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Nested Iif statements    
 
   
kh_9405
post Mar 29 2006, 04:56 PM
Post #1

New Member
Posts: 18



To me this looks correct, however it is not working.

The statement is:
IIf([Last Date]="No Elme","No Elme",IIf([Last Date]>=[Pressure_Inspctn Target Date],"Up to Date",[Last Date]))

Here are the SQL details:

SELECT [qryBase_LstDate_Pressr_PerUnit B].Ramp_Code,
[qryBase_LstDate_Pressr_PerUnit B].[Lift_Unit#],
IIf([Last Date]="No Elme","No Elme",IIf([Last Date]>=[Pressure_Inspctn Target Date],"Up to Date",[Last Date]))
AS Pressure_Insp_Date FROM [qryBase_LstDate_Pressr_PerUnit B] INNER JOIN qryBase_Prs_TrgtDate
ON [qryBase_LstDate_Pressr_PerUnit B].Ramp_Code = qryBase_Prs_TrgtDate.Ramp_Code
GROUP BY [qryBase_LstDate_Pressr_PerUnit B].Ramp_Code, [qryBase_LstDate_Pressr_PerUnit B].[Lift_Unit#], IIf([Last Date]="No Elme","No Elme",IIf([Last Date]>=[Pressure_Inspctn Target Date],"Up to Date",[Last Date]));

My problem is that instead of bringing back "Up to Date", it just gives me the last date. Originally I did not have the first Iif statement in there, thinking that since the query with [Last Date] was written to bring back either the max date or "No Elme", that "No Elme" would come back as [Last Date], but it didn't.

Any ideas or thoughts?

Thanks,

Kathy
Go to the top of the page
 
+
Jerry Dennison
post Mar 29 2006, 05:00 PM
Post #2

Head Wizard
Posts: 14,857
From: South Carolina, USA



If [Last Date] is a date field then it will never = "No Elme" which is text.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 03:16 PM