Using a table named CountNumber with field CountNUM containg numbers from 0
(zero) throurh 12 it will produce the results below --
SELECT
Format(DateAdd("m",[CountNUM],DateSerial(Year(Date()),Month(Date())-4,0)),"mmmm")
AS [Month],
DateAdd("m",[CountNUM],DateSerial(Year(Date()),Month(Date())-4,0))-45 AS
Earliest_Date,
DateAdd("m",[CountNUM],DateSerial(Year(Date()),Month(Date())-4,0)) AS End_Date
FROM CountNumber
WHERE
(((DateAdd("m",[CountNUM],DateSerial(Year(Date()),Month(Date())-4,0)))<DateSerial(Year(Date()),11,0)) AND ((Month(DateAdd("m",[CountNUM],Date())))<=12));
Month Earliest_Date End_Date
October 9/16/2009 10/31/2009
November 10/16/2009 11/30/2009
December 11/16/2009 12/31/2009
January 12/17/2009 1/31/2010
February 1/14/2010 2/28/2010
March 2/14/2010 3/31/2010
April 3/16/2010 4/30/2010
May 4/16/2010 5/31/2010
June 5/16/2010 6/30/2010
July 6/16/2010 7/31/2010
August 7/17/2010 8/31/2010
September 8/16/2010 9/30/2010
--
Build a little, test a little.
"kc" wrote:
> I need to group a report by dates that are within 45 days of the end of the
> month, such as:
> For the month of: Earliest Date Latest Date
> January 12/17/2009 1/31/2009
> February 1/14/2010 2/28/2010
> Etc.
>
> I also need the first and last month to have custom dates because it is for
> a report that goes by the Federal Fiscal Year of Oct-Sept, so:
> For the month of: Earliest Date Latest Date
> October 10/1/2009 10/31/2009
> November 10/16/2009 11/30/2009
> …
> September 8/16/2010 9/30/2010
> October 9/16/2010 9/30/2010
>
> The report is going to list clients to contact during the month and within
> 45 days of their birthday.
> Because of the overlap, some clients will be in two groups, so personnel
> will know to start trying to contact them as soon as possible, but they will
> also be on the list for the next month (unless of course, contact has already
> been made, in which case they will drop off the query) to ensure follow up if
> not contacted.
>
> Any ideas? Or is this possible?
>
> Thanks for any help!
> kc
>
|