Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2005

Tip: Looking for answers? Try searching our database.

Number of Days Calculation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Deb - 08 Nov 2005 00:20 GMT
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!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.