I have a form for dealing with purchase orders with a subform for the items being ordered. I'm trying to get a field on my main form to be a running total field, so as the user inputs information on the subform, the field will update with the total cost of the order.
I have it right now where it updates to the correct total when the shipping or tax information changes on the main form, but I can't figure out how to get the subform changes to update correctly
There are only 2 fields on the subform I want the check for changes, quantity or price. Right now, both have code to update the Amount field of the subform on a change, so I could probably just check for a change on the amount field, but can't get it to work.
I tried the following code and it would update about half the time, but it was always the incorrect value. Any help is appreciated. Thanks.
Dim dPrice As Double
Dim rs As Recordset
dPrice = 0
Set rs = Me.RecordsetClone
While Not rs.EOF
dPrice = dPrice + rs.Fields("Amount").Value
dPrice = dPrice + Forms![frmMain]![txtShipping].Value + Forms![frmMain]![txtTax].Value
Forms![frmMain]![txtTotal].Value = dPrice