Number of Days Calculation

D

Deb

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!!
 
D

David S via AccessMonster.com

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()).
 
Top