Can anyone suggest a bit of code to calculate the months between an end date in one record/row and the start date in the next record/row of a record set. The following is a synopsis of the problem area in my code:
Set rsA = CurrentDb.OpenRecordset("SELECT * FROM yada, yada, yada ....)
Dim intCalcGap1 As Integer
Dim intCalcGap2 As Integer
Dim intCalcGap As Integer
intCalcGap1 = rsA!End_Date
rsA.MoveNext
intCalcGap2 = rsA!Start_Date
rsA.MovePrevious
intCalcGap = DateDiff ("m", intCalcGap1, intCalcGap2)
If CalcGap > 1 then
rsAMoveNext
End If
I have no idea how to do this - any advice will be greatly appreciated.
Thanks a bunch-
colleen
Set rsA = CurrentDb.OpenRecordset("SELECT * FROM yada, yada, yada ....)
Dim intCalcGap1 As Integer
Dim intCalcGap2 As Integer
Dim intCalcGap As Integer
intCalcGap1 = rsA!End_Date
rsA.MoveNext
intCalcGap2 = rsA!Start_Date
rsA.MovePrevious
intCalcGap = DateDiff ("m", intCalcGap1, intCalcGap2)
If CalcGap > 1 then
rsAMoveNext
End If
I have no idea how to do this - any advice will be greatly appreciated.
Thanks a bunch-
colleen