J
Joan
Hi,
I have a form with several subforms on it. This form and its subforms
are used for editing or deleting data. On one of these subforms, I have a
Delete button for each record in case the user would like to delete that
record from the form. In my code for the OnClick event, I delete the record
and then update a control on the main form that is bound to a field in its
underlying table. The problem is that after the user clicks the delete
button, the record is taken off of the subform but before than user can do
anything else, the main form goes to the first record in it's underlying
table and the rest of the code that updates the main form's !txtDebit does
not run. Why is it doing this?? I cannot figure this out. Would so
appreciate any ideas on why this is happening! Below is my code for the
ClickEvent:
Private Sub cmdDeleteOthChrg_Click()
On Error GoTo Err_cmdDeleteOthChrg_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
With Me.Parent
!txtDebit = ![InvoiceDetailsSubEdit]![ExtendedPriceSum]
.Recalc
End With
Exit_cmdDeleteOthChrg_Click:
Exit Sub
Err_cmdDeleteOthChrg_Click:
MsgBox Err.Description
Resume Exit_cmdDeleteOthChrg_Click
End Sub
Joan
I have a form with several subforms on it. This form and its subforms
are used for editing or deleting data. On one of these subforms, I have a
Delete button for each record in case the user would like to delete that
record from the form. In my code for the OnClick event, I delete the record
and then update a control on the main form that is bound to a field in its
underlying table. The problem is that after the user clicks the delete
button, the record is taken off of the subform but before than user can do
anything else, the main form goes to the first record in it's underlying
table and the rest of the code that updates the main form's !txtDebit does
not run. Why is it doing this?? I cannot figure this out. Would so
appreciate any ideas on why this is happening! Below is my code for the
ClickEvent:
Private Sub cmdDeleteOthChrg_Click()
On Error GoTo Err_cmdDeleteOthChrg_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
With Me.Parent
!txtDebit = ![InvoiceDetailsSubEdit]![ExtendedPriceSum]
.Recalc
End With
Exit_cmdDeleteOthChrg_Click:
Exit Sub
Err_cmdDeleteOthChrg_Click:
MsgBox Err.Description
Resume Exit_cmdDeleteOthChrg_Click
End Sub
Joan