DateDiff Function and Negative Values

JH40

Registered User.
Local time
Yesterday, 23:29
Joined
Sep 16, 2010
Messages
100
Can someone offer to assist me with correcting my expression below? I'm looking to have negative values return as zero rather than the actual negative number. Sometimes the Last Discharge Date is blank, so a blank return is needed, and sometimes it is actually before the Admit Date, so negative is correct; however, I'd rather the negative number display as zero:

Days Between Last D/C and Admit Dates: IIf([Last Discharge Date]="","",Nz(DateDiff('d',[Last Discharge Date],[Admit Date]),0))

Thank you!
 
Try;
Code:
IIf([Last Discharge Date]="","",IIf(Nz(DateDiff('d',[Last Discharge Date],[Admit Date]),0)>0,Nz(DateDiff('d',[Last Discharge Date],[Admit Date]),0),0))
 

Users who are viewing this thread

Back
Top Bottom