Hi,
In an Access query I am using an IIf statement below to calculate the time between two dates; this is defined as [Period1]:
In the same query I am using the following IIf statement to return [Period1] or a 0:
The problem I have is with the 0; this works fine if the above statement is simply:
but as soon as I add the additional criteria 'or [DateTreatmentSt arted1] is null' to the statement it stops returning a 0. It does return [Period1] though.
I can't fathom why the 0 is not returned as a result of the change. I've tried a nested IIf also, but the same result.
[UnavailabilityS tartDate1], [UnavailabilityE ndDate1], [EffectiveStartD ate] and [DateTreatmentSt arted1] are all date fields.
Appreciate any help
LG
In an Access query I am using an IIf statement below to calculate the time between two dates; this is defined as [Period1]:
Code:
Period1: IIf([UnavailabilityEndDate1]<Date(),DateDiff('d',[UnavailabilityStartDate1],[UnavailabilityEndDate1],DateDiff('d',[UnavailabilityStartDate1],Date())))
In the same query I am using the following IIf statement to return [Period1] or a 0:
Code:
ExcludePeriod1: IIf([UnavailabilityStartDate1] Between [EffectiveStartDate] And [DateTreatmentStarted1] Or [DateTreatmentStarted1] Is Null,[Period1],0)
The problem I have is with the 0; this works fine if the above statement is simply:
Code:
ExcludePeriod1: IIf([UnavailabilityStartDate1] Between [EffectiveStartDate] And [DateTreatmentStarted1],[Period1],0)
I can't fathom why the 0 is not returned as a result of the change. I've tried a nested IIf also, but the same result.
[UnavailabilityS tartDate1], [UnavailabilityE ndDate1], [EffectiveStartD ate] and [DateTreatmentSt arted1] are all date fields.
Appreciate any help
LG
Comment