Synchronizing main form with subform

  • Thread starter Thread starter Joan
  • Start date Start date
J

Joan

Hi,
I have a subform on a main form in edit mode. When I attempt to delete a
record on the subform, this action is not immediately reflected in the
totals textbox on the main form. However, when I add another record on the
subform , then the totals textbox on the main form reflects both the
deletion and the additional record. What do I need to add to my code to get
the the totals textbox synchronized with my subform? And why does it not
synchronize just when I delete a record and not when I edit or add a record?

I have tried using .Recalc and .Requery but no luck. Below is the code I
have on the On Delete event of my subform:

Private Sub Form_Delete(Cancel As Integer)
Me.Recalc

With Me.Parent
.Recalc
.Requery
!txtDebit = ![InvoiceDetailsSubform]![ExtendedPriceSum]
End With
End Sub


Private Sub Form_AfterUpdate()
Me.Recalc
With Me.Parent
.Recalc
!txtDebit = ![InvoiceDetailsSubform]![ExtendedPriceSum]
End With
End Sub


Joan
 
Before anyone goes to the trouble of answering my post, I finally figured
out that the code I had on the subform's Delete event should be on the After
Del Confirm event instead.

Joan
 
Back
Top