B
Bill
I have a subform "TransAcctSubform" whose
RecordSource contains records all of whose
field names begin with "Trans". For purposes
of explanation here, envision a transaction
ledger in which each record contains expense,
income and running total amounts.
The code below is intended to loop through
the records and update the running totals by
algebraically adding the expense and income
to the previous total and saving the new total
in the current record, (see the statement next
in sequence to the ".Edit").
The code runs without any errors, but has no
effect on the totals. It's as though the addition
statement doesn't execute. Since this is my
first shot at attempting updates to recordsets
within a subform, I have to assume here that
I'm not addressing the record elements
correctly...........or something like that.
Any glaring issues jump out?
Dim tempAmt As Currency
If Me!TransAcctSubform.Form.Dirty Then
Me!TransAcctSubform.Form.Dirty = False
End If
Me!TransAcctSubform.Form.RecordsetClone.MoveFirst
Me!TransAcctSubform.Form.Bookmark =
Me.TransAcctSubform.Form.RecordsetClone.Bookmark
tempAmt = Me!TransAcctSubform.Form.[TransBal]
With Me!TransAcctSubform.Form.RecordsetClone
.MoveNext
While Not (.EOF)
.Edit
.[TransBal] = .[TransBal] + .[TransExp] + .[TransInc]
.MoveNext
Wend
End With
End Sub
RecordSource contains records all of whose
field names begin with "Trans". For purposes
of explanation here, envision a transaction
ledger in which each record contains expense,
income and running total amounts.
The code below is intended to loop through
the records and update the running totals by
algebraically adding the expense and income
to the previous total and saving the new total
in the current record, (see the statement next
in sequence to the ".Edit").
The code runs without any errors, but has no
effect on the totals. It's as though the addition
statement doesn't execute. Since this is my
first shot at attempting updates to recordsets
within a subform, I have to assume here that
I'm not addressing the record elements
correctly...........or something like that.
Any glaring issues jump out?
Dim tempAmt As Currency
If Me!TransAcctSubform.Form.Dirty Then
Me!TransAcctSubform.Form.Dirty = False
End If
Me!TransAcctSubform.Form.RecordsetClone.MoveFirst
Me!TransAcctSubform.Form.Bookmark =
Me.TransAcctSubform.Form.RecordsetClone.Bookmark
tempAmt = Me!TransAcctSubform.Form.[TransBal]
With Me!TransAcctSubform.Form.RecordsetClone
.MoveNext
While Not (.EOF)
.Edit
.[TransBal] = .[TransBal] + .[TransExp] + .[TransInc]
.MoveNext
Wend
End With
End Sub