Hello,
I am having issues with this date loop and cant figure out why. I am sure I am missing something.
I have two dates, one start and one end. I'm using DateDiff to get the amount of months between the start and end dates. The loop increments the start date every 3 months. Once iMos gets above 3 months it should stop the loop. iMos is not changing value when the loop updates the start date. iMos stays at 2.
I have also tried Do While and the same thing happens with the value of iMos not changing.
Code:
Private Sub btn_Test_Click()
Dim dStart As Date
Dim dEnd As Date
Dim iMos As Integer
dStart = CDate(Format("01/17/2020", "mm/dd/yyyy"))
dEnd = CDate(Format("11/01/2019", "mm/dd/yyyy"))
iMos = DateDiff("m", dEnd, dStart)
Do
dStart = DateAdd("m", 3, dStart)
'Debug.Print dStart
Loop Until iMos >= 3
End Sub
MS Access 2013
.accdb
Thanks for all the help in advance.