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

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Iif Question    
 
   
swmorin
post Apr 1 2012, 10:26 AM
Post #1

UtterAccess Addict
Posts: 143



I have a field in a form that I want to say C/W or Not C/W depending on some criteria.

FIrst Criteria is whether or [CW_date] is a date
Second Criteria is whether or not [CW_date] older than a certain number of days

But the second criteria is only needed if the [reqtype] = 2

so can you have an IIF in a IIF statement?
Go to the top of the page
 
+
Peter46
post Apr 1 2012, 10:35 AM
Post #2

UtterAccess VIP
Posts: 7,394
From: Oadby Leics, UK



What is the datatype of CW_Date?
Go to the top of the page
 
+
theDBguy
post Apr 1 2012, 10:35 AM
Post #3

Access Wiki and Forums Moderator
Posts: 47,914
From: SoCal, USA



Hi,

What version of Access are you using? Please remember to select the version number when posting questions in case it becomes relevant to the discussion.

Yes, you can nest IIf() statements. For example:

IIf(Condition=True, IIf(Condition=True, True, False), False)

Just my 2 cents... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
swmorin
post Apr 1 2012, 10:46 AM
Post #4

UtterAccess Addict
Posts: 143



cw_date is a date

and 2007 is the version
Go to the top of the page
 
+
arnelgp
post Apr 1 2012, 11:03 AM
Post #5

UtterAccess Ruler
Posts: 1,090



IIF( IsDate([cw_date]), IIF([cw_date] > number of days And [reqType] = 2, ValueTrue, ValueFalse), ValueFalse)
Go to the top of the page
 
+
swmorin
post Apr 1 2012, 11:07 AM
Post #6

UtterAccess Addict
Posts: 143



so here is the IIF statement I am working on
I am getting a syntax error

CODE
IIF(isdate([cw_date]),IIF([reqtype] = 2),IIF([CW_date] + [REQINTERVAL] < now(),"Overdue", "C/W"),"C/W" "Not C/W")
Go to the top of the page
 
+
arnelgp
post Apr 1 2012, 11:16 AM
Post #7

UtterAccess Ruler
Posts: 1,090



IIF( IsDate([cw_date]), IIF(([cw_date] + [REQINTERVAL] < Now()) And ([reqtype] = 2), "Overdue", "C/W"), "Not C/W")
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: 18th May 2013 - 10:29 PM