jasonatsmtc
Technical User
Hello,
I am trying to create a function that will take two inputted dates, from 2 MS Date Time Pickers, dtArrival and dtDepart, and create veriables for those dates and every date in between. Here is the code that i am trying to use.
[vb]
Public varDate() As Date
Public varIndex As Integer
Public Sub InitDates()
varIndex = 1
ReDim varDate(0) As Date
varDate(0) = frmMakeReso.dtArrival.Value
Do Until varDate(varIndex) = frmMakeReso.dtDepart.Value
varIndex = varIndex + 1
ReDim varDate(varIndex) As Date
varDate(varIndex) = DateAdd("d", 1, varDate(varIndex - 1))
Loop
End Sub
[/vb]
This gives me run-time error 9, "Subscript out of range"
Please let me know if you see anything i can change in this code to make it work, or if you know a better way to go about it.
Thanks in advance!
Jason C.
I am trying to create a function that will take two inputted dates, from 2 MS Date Time Pickers, dtArrival and dtDepart, and create veriables for those dates and every date in between. Here is the code that i am trying to use.
[vb]
Public varDate() As Date
Public varIndex As Integer
Public Sub InitDates()
varIndex = 1
ReDim varDate(0) As Date
varDate(0) = frmMakeReso.dtArrival.Value
Do Until varDate(varIndex) = frmMakeReso.dtDepart.Value
varIndex = varIndex + 1
ReDim varDate(varIndex) As Date
varDate(varIndex) = DateAdd("d", 1, varDate(varIndex - 1))
Loop
End Sub
[/vb]
This gives me run-time error 9, "Subscript out of range"
Please let me know if you see anything i can change in this code to make it work, or if you know a better way to go about it.
Thanks in advance!
Jason C.