Mike Krailo
Well-known member
- Local time
- Today, 18:01
- Joined
- Mar 28, 2020
- Messages
- 1,694
Updating the main form total works great using an after update event for adding new items in the subform but does no good when a record is deleted. The On Delete event doesn't work because, the totals have not updated yet (it seems to only fire pre delete). The After Delete Confirmation event only works if confirmations are turned on and in my case they are not. So the only event that comes close is the On Exit which does work but I would like to know if there is a way to update the totals on the main form without leaving the subform.
Update, the following code fixed my issue with the update after deletion of a subform record.
Update, the following code fixed my issue with the update after deletion of a subform record.
Code:
Private Sub Form_Delete(Cancel As Integer)
Me.Parent!Subtotal = Me.SubformTotal - Me!ItemTotal
Me.Parent!OrderTotal = Me.Parent!Subtotal + Nz(Me.Parent!Freight)
End Sub
Last edited: