Posted By: JRSmith — 10 Aug 2012 at 10:27am
I need to select records based on a date range that starts with January 1 of this year and runs through the last day of last month (based on the current date).
I also need to select the same date period for the previous year.
Thanks in advance for your help.
Posted By: z9962 — 13 Aug 2012 at 3:02am
//last day of month
//Date(DateAdd("d",-day(today),DateAdd("m",1,today)))
//First day of year
//date(year(today),1,1)
//last day of month last year
//Date(DATEADD("yyyy",-1,DateAdd("d",-day(today),DateAdd("m",1,today))))
//First day of previous year
//date(year(today)-1,1,1)
therefore
(
[datefield] in date(year(today),1,1) to Date(DateAdd("d",-day(today),DateAdd("m",1,today)))
or
[datefield] in date(year(today)-1,1,1) to Date(DATEADD("yyyy",-1,DateAdd("d",-day(today),DateAdd("m",1,today))))
)
Posted By: JRSmith — 13 Aug 2012 at 10:24am
Thanks for your help. A little tweeking in my report and it worked.