Hi,
I'm trying to create an array of dates. But am getting a run time error 9, subscript out of range error on the arrDates(i1) = iDate line. It looks like this should be an easy fix, but I can't find the cause of the problem (don't have the brainpower).
Can anyone advise where I may be going wrong?
Thanks,
K
I'm trying to create an array of dates. But am getting a run time error 9, subscript out of range error on the arrDates(i1) = iDate line. It looks like this should be an easy fix, but I can't find the cause of the problem (don't have the brainpower).
Can anyone advise where I may be going wrong?
Thanks,
K
Code:
startDateVar = Forms![fdlg_Event/Task]![StartDate].Value
endDateVar = Forms![fdlg_Event/Task]![EndDate].Value
daysBetweenDates = endDateVar - startDateVar
'create an array of dates
iDate = startDateVar
i1 = 0
For i1 = 0 To daysBetweenDates - 1
arrDates(i1) = iDate
iDate = DateAdd("d", 1, iDate)
Next