Expiry Date

.Justin

Registered User.
Local time
Today, 23:14
Joined
Jun 29, 2009
Messages
38
Hi All,

I have a query which shows data about certain checks that are carried out employees. One of the fields is Expiry Date of the check. What I want is for the query to show only records that have a expiry date which has expired or is going to expire within the next three months of today's date. But I cannot work out how to do it!
 
try

where expirydate<dateadd("m",3,Date())
 
...next three months of today's date...

CJ's answer is correct, but whenever you want to mix date units that don't have the same underlying units it can cause unexpected results. Not every month has the same amount of days.

What I would do is take CJ's answer and make sure it returns what you want for the edge cases. For example, using CJ's code:

3 months after 11/28/2014, 11/29/2015 and 11/30/2015 are all 2/28/2015
--- which are 92, 91 and 90 days respectively

3 months after 1/31/2015 is 4/30/2015
--- which is 89 days

Again, CJ probably gives you what you want, but "3 months" can be ambigous in terms of days.
 

Users who are viewing this thread

Back
Top Bottom