N
Nicholas Scarpinato
I have a report I'm running that has a set of formulas in it for various data
calculations that I don't need to store anywhere. However, I *DO* need to
store the end result of those formulas in a table field. I wrote a bit of
code to do this when the report is closed, but it only stores the value shown
on the current page of the report, not the value for every page. (There are
34 records to update and each record has it's own page on the report.) The
code I'm using is as follows:
Private Sub Report_Close()
Dim db, rs, sql, CMCarryforward
sql = "SELECT * FROM [Carryforward]"
Set db = CurrentDb
Set rs = db.OpenRecordset(sql)
With rs
.MoveFirst
Do Until .EOF
CMCarryforward = [Profit/Loss]
.Edit
rs.Fields("Current Month Carryforward") = Me![Profit/Loss]
.Update
.MoveNext
Loop
End With
rs.Close
db.Close
End Sub
How do I get my report to populate the table fields on a record-by-record
basis, rather than using the number on the page of the report I happen to be
viewing when I close the report?
calculations that I don't need to store anywhere. However, I *DO* need to
store the end result of those formulas in a table field. I wrote a bit of
code to do this when the report is closed, but it only stores the value shown
on the current page of the report, not the value for every page. (There are
34 records to update and each record has it's own page on the report.) The
code I'm using is as follows:
Private Sub Report_Close()
Dim db, rs, sql, CMCarryforward
sql = "SELECT * FROM [Carryforward]"
Set db = CurrentDb
Set rs = db.OpenRecordset(sql)
With rs
.MoveFirst
Do Until .EOF
CMCarryforward = [Profit/Loss]
.Edit
rs.Fields("Current Month Carryforward") = Me![Profit/Loss]
.Update
.MoveNext
Loop
End With
rs.Close
db.Close
End Sub
How do I get my report to populate the table fields on a record-by-record
basis, rather than using the number on the page of the report I happen to be
viewing when I close the report?