![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I would like to find the end of month dates for each month between a given date range. For instance if the user of my database entered a start date of 01/01/10 and an end of 12/31/10, the result would display 01/31/10, 02/28/10, 03/31/10, etc... until the end of month date is equal to then end date of 12/31/10. Thanks for the help. |
#3
| |||
| |||
|
|
I would like to find the end of month dates for each month between a given date range. *For instance if the user of my database entered a start date of 01/01/10 and an end of 12/31/10, the result would display 01/31/10, 02/28/10, 03/31/10, etc... until the end of month date is equal to then end date of 12/31/10. Thanks for the help. |
#4
| |||
| |||
|
|
On Aug 17, 12:45*pm, Matt <mfied... (AT) 1fbusa (DOT) com> wrote: I would like to find the end of month dates for each month between a given date range. *For instance if the user of my database entered a start date of 01/01/10 and an end of 12/31/10, the result would display 01/31/10,02/28/10, 03/31/10, etc... until the end of month date is equal to then end date of 12/31/10. Thanks for the help. Copy paste this in a code module and run from the immediate window. Maybe it will help. Sub Next12() * * Dim i As Integer * * Dim d As Date * * d = #1/15/2011# * * For i = 1 To 12 * * * * d = DateAdd("m", 1, d - Day(d) + 1) - 1 * * * *Debug.Print d * * * *d = DateAdd("m", 1, d) * * Next * * 'MsgBox "Done * *" End Sub |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Have you considered using a dateandtime table? This is common practice in business intelligence designs. You have a table with each day/date/year, day of the week, workday, weekend, first of month, last of month, holiday, and so on. It's very handy for structuring data. If you add a unique-id as well it becomes very easy to use in JOIN statements. Wow, that sounds like a really good idea! |
![]() |
| Thread Tools | |
| Display Modes | |
| |