Using Access 2003: have a query which calculates the total number of days
using 2 date fields (admit date and discharge date). If the discharge date
is null, I would like to use todays date in its place. My guess is an IIF
statement would be used, but I have no idea as how to write it. HELP!!

Signature
All help greatly appreciated.
David S - 08 Nov 2005 00:31 GMT
Try this:
DateDiff("y",[admit date],IIf([discharge date] Is Null,Now(),[discharge date])
)
Now() includes the time, so I'm not quite sure whether that will affect the
number of days; if it's important, you could get just today's date with
DateSerial(Year(Now(), Month(Now()), Day(Now()).
Van T. Dinh - 08 Nov 2005 02:02 GMT
DateDiff("d", [AdmitDate], IIf( [DischDate] Is Null, Date(), [DischDate]))

Signature
HTH
Van T. Dinh
MVP (Access)
> Using Access 2003: have a query which calculates the total number of days
> using 2 date fields (admit date and discharge date). If the discharge
> date
> is null, I would like to use todays date in its place. My guess is an IIF
> statement would be used, but I have no idea as how to write it. HELP!!