Joe Reed wrote:
I need to populate either an array or table with the following date
information. These dates are used to build an effort number based on
what month a records subscription expires.
Drop9_Start: 11/01/04 Drop9_End: 11/30/04
Drop8_Start: 12/01/04 Drop8_End: 12/31/04
Drop7_Start: 01/01/05 Drop7_End: 01/31/05
Drop6_Start: 02/01/05 Drop6_End: 02/28/05
Drop5_Start: 03/01/05 Drop5_End: 03/31/05
Drop4_Start: 04/01/05 Drop4_End: 04/30/05
Drop3_Start: 05/01/05 Drop3_End: 05/31/05
Drop2_Start: 06/01/05 Drop2_End: 06/30/05
Drop1_Start: 07/01/05 Drop1_End: 07/31/05
Basically I want to ask for a date which is the beginning date of a
month, in this example I would input 03/01/05 and based on that I would
want to get the beginning date and ending date of 4 months prior to
03/01/05 and 4 months into the future from 03/01/05. I hope this makes
sense.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I wouldn't set up a table as you've described, but an array would be OK.
Function assignDates(dteInitial As Date) As Variant
' set up a 2 dimension array
' the 1st dimension has 9 elements for the Drop1-9
' the 2nd dimension has 2 elements: the start date & the end date
Dim dte(0 To 8, 1 To 2) As Variant
Dim i As Integer
Dim dteStart As Date
dteStart = DateAdd("m", -4, dteInitial)
For i = 0 To 8
dte(i, 1) = DateAdd("m", i, dteStart)
dte(i, 2) = DateAdd("m", 1, dte(i, 1)) - 1
Next i
assignDates = dte
End Function
Call this function like this:
dim d() as variant
dim dte as date
dte = #3/1/05#
d() = assignDates(dte)
d(0,1) would be Drop9_Start
d(0,2) would be Drop9_End
d(8,1) would be Drop1_Start
d(8,2) would be Drop1_End
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQi+FoIechKqOuFEgEQLvxACg5qPGn5cgTUBLMiKnMUkPxB TDvRMAnRbd
dLyeGlXf98f7yb1CqnWrhSUB
=MF2+
-----END PGP SIGNATURE-----