I am trying to create a date range timeline process in Access the same way that Excel can increment a Date in a cell by dragging that value down to the rows.
How it works is the user enters a start date (the length of days is predefined), and then a timeline is automatically created after the user clicks on the
timeline tab. I have no problem incrementing the date value by 1 for the start date by using the dateAdd function.
However, the EndDate, which is a seperate field in the table, must get prepopulated with only the milestone dates as defined by the task.
The table should look like this:
StartDate EndDate
10/1/12
10/2/12
10/3/12 10/3/12 'increment by 3
10/4/12
10/5/12
10/6/12 10/6/12 'increment by 2
10/7/12
10/8/12 10/8/12 'increment by 1...etc
The code below works however it skips rows (3 times) only for the first entry and fails to skip the desired number of rows (or days) and
stops incrementing by the predefined fieldvalue of rs!Days: 'rs!Days is a field in the table that specifies the number of days each task
should take.
Code:
For int = 1 to 45 (total number of days in a timeline)
StartDate = DateAdd("d", rs!Days, StartDate)
with rs
.Edit
!EndDate = StartDate
.Update
end with
Next int
Please help. I've been looking at this for several weeks now and have come up with so many code scenarios that have been unsuccessful.
Any input would be greatly appreciated.Thank you. |
|
|
|