I've written some code that calculates the interest portion of 180 loan payments and updates the fields INT1 …INT180. It works fine but takes forever to run because its doing 180 updates per record. Is their a more efficient way to do this?
Public Function IntPmt()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim f As String
Dim t As Double
Dim c As Double
Dim r As Double
Dim b As Double
Set db = CurrentDb()
Set rs = db.OpenRecordset("tbl_IntPmt", dbOpenDynaset)
Do While Not rs.EOF
t = rs![TERM]
r = rs![Rate] / 12
b = rs![RPMT BAL]
c = 1
For c = 1 To t
f = "INT" & c
rs.Edit
rs(f) = Abs(IPmt(r, c, t, b, 0, 0))
rs.Update
Next c
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
End Function