I've assumed in this code that your "EndDate" is supposed to be the first of each successive month, rather than the end of that month. If it should be the end of the month, then adjust Jan1 to Jan31 and fDate to "DateSerial(ThisYear,Month(sDate),31)".
I've optimized the code a bit by calculating static dates once, then using those calculated value, rather than recalculating them each time through.
Code:
db.Execute "QryDeleteTblTemp"
rsin.MoveFirst
Dim Amount As Double, months As Integer, i As Integer
Dim ThisYear as integer
Dim WorkDate As Date, sDate As Date, fDate as Date
Dim Jan1 As Date, Feb1 As Date, Dec31 As Date
Dec31 = DateSerial(Year(Date), 12, 31)) ' last day of this year
Jan1 = DateSerial(Year(Date), 01, 01)) ' Jan 1 of this year
Feb1 = DateSerial(Year(Date), 02, 01)) ' Feb 1 of this year
ThisYear = Year(Date)
Do While Not rsin.EOF
sDate = rsin("EstStartDate")
' If estStartDate is after Feb 1 of this year, use first day
' of sDate's month,
' otherwise start Jan 1 of this year.
if sDate < Feb1 Then
fDate = Jan1
months = 12
Else
fDate = DateSerial(ThisYear,Month(sDate),01)
months = 13 - Month(sDate)
End if
Amount = rsin("CapitalAmt") / rsin("DepMos")
For i = 0 To months - 1
rsout.AddNew
rsout("EndDate") = DateAdd("m", i, fDate)
rsout("DepreciationAmt") = Amount
rsout("ProjectID") = rsin("ProjectID")
rsout("EstStartDate") = sDate
rsout("months") = months
rsout.Update
Next i
rsin.MoveNext
Loop