Actually, your 'MoveFirst' statement needs to be outside the loop, otherwise you keep returning to the first record with every cycle. Try it like this:
rsJobCost.MoveFirst
Do While rsJobCost.EOF = False
MsgBox Left(del_date, 4)
If Left(del_date, 4) <> YearTxt Then
YTD = YTD
End...