calculated field on main form

rdw456

Novice
Local time
Yesterday, 21:45
Joined
Jul 20, 2012
Messages
43
I have a main form with several with four subforms. On the main form I have a bound text box [ShiftTotal] I have on each subform a unbound text box that sums a field [ExtTaxIn]. I am working with just one subform till I can get it to work correctly. The code I am using on the after update event is as follows.

code
-----------------------------------------------------------------------
Private Sub TxtSoldQty_AfterUpdate()
On Error GoTo HandleError

Me.ExtTaxIn = (Me.TxtSoldQty * Me.TaxIn)
Me.ExtPrice = (Me.TxtSoldQty * Me.Price)
Me.InvSold = (Me.TxtSoldQty * Me.UnitOfSale)
Forms!frmShiftMain!TxtShiftTotal = Forms!frmShiftMain!TxtRunningTotal
Me.txtExtTaxIn.Requery

Exit Sub

HandleError:
GeneralErrorHandler Err.Number, Err.Description, "modBusinessLogic", _
"TxtSoldQty_AfterUpdate"

Resume Next
Resume

Exit Sub

End Sub

This sort of works but the [ShiftTotal] on the main form is always one table row behind. I think this is because of the order the event fires but can't seem to work my way around it so open to solution if possible or any idea's

Thanks Bob :banghead:
 
Where do you get txtRunningTotal?

Dale
 
This sort of works but the [ShiftTotal] on the main form is always one table row behind. I think this is because of the order the event fires but can't seem to work my way around it so open to solution if possible or any idea's

Thanks Bob :banghead:

If you expect the refresh to include new records just added you cannot use the AfterUpdate event. For new records, use AfterInsert instead.

Best,
Jiri
 

Users who are viewing this thread

Back
Top Bottom