ANOTHER date range issue

razorkat99

Still figurin' it out
Local time
Today, 10:08
Joined
Oct 22, 2007
Messages
35
Just when you thought there weren't enough questions in this forum having to do with date range. :) No snide comments please, I've been searching the forum for a couple days now and still coming up with the same info I keep trying and then some.

All I'm trying to get is records for today's date + 60 days.

None of these arguments are working:

DateAdd("d",61,[LeaseExpiration]) - brings back 0 records
DateAdd("d",+61,[LeaseExpiration]) - brings back 0 records
>Date()-[How many days out?] -brings back all records 60 days or more
Date()-[How many days out?] -brings back 0 records
Date()+[How many days out?] -brings back 0 records

I would prefer not to use a date RANGE and I do have dates that fall w/in 60 days from today's date, so it should be bringing the records back. Where am I going wrong?

 
There is another function called DateSerial that might be helpful. See if it gets you closer to what you are looking for.

SELECT Now(), DateSerial(Year(now()),Int((Month(now())+6)),Day(now()))
 
I'm not completely sure what you're wanting.
"for today's date + 60 days"
Does that mean you want results which only occur on one single day which is 60 days from today? Or for all days today and the next 60 days? Are the end dates inclusive?
But then you say "I would prefer not to use a date RANGE". By that, do you mean fixed date literals?

Is, ultimately, all you want (in the QBE)
>=Date() AND < DateAdd("d",61,Date())
or in SQL
WHERE LeaseExpiration >=Date() AND LeaseExpiration < DateAdd("d",61,Date())
 
And my preference is using

Between DateAdd("d", -60, Date()) And Date()
 
I just tend to offer (and use really) the earlier syntax to allow for time components in the field.
 
Just when you thought there weren't enough questions in this forum having to do with date range. :) No snide comments please, I've been searching the forum for a couple days now and still coming up with the same info I keep trying and then some.

All I'm trying to get is records for today's date + 60 days.

>DateAdd("d",61,[LeaseExpiration])
 
Thank you LPurvis... your simple solution >=Date() AND < DateAdd("d",61,Date()) was the most practical and worked the best for what I needed. Although there is a range it requires no key strokes from the operator, which is perfect.
 

Users who are viewing this thread

Back
Top Bottom