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 / December 2005

Tip: Looking for answers? Try searching our database.

Calc months left with no negatives

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 08 Dec 2005 03:59 GMT
I'm using the following formula in a query to calculate the number of months
left on a lease based on a set end date and todays date:
MonthsLeft: DateDiff("m",Now(),[EndDate])

I dont want it to display negative numbers though for leases that have
finished.
How do i get it to show a "0" for dates that have already past or if the
number is going to show a negative

thanks
Daniel
Van T. Dinh - 08 Dec 2005 04:37 GMT
MonthsLeft: IIf( [EndDate] < Date(), 0, DateDiff("m", Date(), [EndDate]) )

Signature

HTH
Van T. Dinh
MVP (Access)

> I'm using the following formula in a query to calculate the number of
> months
[quoted text clipped - 8 lines]
> thanks
> Daniel
 
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.