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 / February 2008

Tip: Looking for answers? Try searching our database.

Display the lesser of two DateDiff expressions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RussCRM - 23 Feb 2008 18:44 GMT
I have two fields - ProgramEntry and ProgramExit.

I want to calculate how long a person has been in a program.  I can do
that with a DateDiff ("d",[ProgramEntry], Date()) expression.  But, I
run into a problem when they exit the program as it will keep adding
dates.  Basically, I'm thinking that maybe I can have it calculate the
two DateDiff expressions and then display the lesser of the two (which
I don't know how to do) unless someone has another suggestion.

Any ideas?
John W. Vinson - 23 Feb 2008 19:56 GMT
>I have two fields - ProgramEntry and ProgramExit.
>
[quoted text clipped - 6 lines]
>
>Any ideas?

You only need one datediff if I understand this correctly:

DateDiff("d", [ProgramEntry], NZ([ProgramExit], Date())

will return the number of days from programentry to programexit *IF* there is
a date in programexit; if there isn't, the NZ function will use today's date
instead.
Signature

            John W. Vinson [MVP]

 
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.