Expression help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone tell me what this expression is doing? What I'm trying to
determine is if this is counting back 365 days from today's date or the
[Screen Date].

IIf(IsNull([DEN1 Screen Date]),0,IIf(DateDiff("d",[DEN1 Screen
Date],Date())<=365,1,IIf(IsNull([DEN2 Screen Date]),0,IIf(DateDiff("d",[DEN2
Screen Date],Date())<=365,1,0))))


Thank you in advance for any help.
 
SVE said:
Can anyone tell me what this expression is doing? What I'm trying to
determine is if this is counting back 365 days from today's date or the
[Screen Date].

IIf(IsNull([DEN1 Screen Date]),0,IIf(DateDiff("d",[DEN1 Screen
Date],Date())<=365,1,IIf(IsNull([DEN2 Screen Date]),0,IIf(DateDiff("d",[DEN2
Screen Date],Date())<=365,1,0))))

SVE,

Let's format the statement:

(I pushed the first IsNull left to save to avoid line-wrapping.)


IIf(
IsNull([DEN1 Screen Date])
,0
,IIf(
DateDiff("d",[DEN1 Screen Date],Date())<=365
,1
,IIf(IsNull([DEN2 Screen Date])
,0
,IIf(DateDiff("d",[DEN2 Screen Date],Date())<=365
,1
,0)
)
)
)

If [DEN1 Screen Date] is null, return 0, otherwise:

If Date() - [DEN1 Screen Date] <= 365, return 1, otherwise:

If [DEN2 Screen Date] is null, return 0, otherwise:

If Date() - [DEN2 Screen Date] <= 365, return 1, otherwise return 0.


That's what the statement is doing.

Sincerely,

Chris O.
 
Back
Top