Number of Days Calculation

G

Guest

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

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

Top