Expression help

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.
 
C

Chris2

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Iif statement 9
Iif Query 5
Help with small result type 2
Update SQL 1
Access Building a IIF expression in Access 0
SQL Mix up? 3
Calculated Field in Query - Date Format 5
Error 3075 4

Top