M
Marty
Howdy All,
I have a main form/sub form arrangement that includes a "Delete" command
button on the main form. The main form shows one record from one table and
the subform shows related records from a different table. Both recordsets
are contained in one transaction. The delete button is intended to delete
all records in the display. When the command button is clicked, the code
that gets executed is:
If Me.Dirty Then
Me.Undo
End If
If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord
End If
Before the second "End If" gets executed, the system fires a Delete event
and the Form_Delete procedure gets control. There is no code in this
procedure, but I put it in just to check that it does get trapped by the
debugger. However, neither the BeforeDelConfirm event or the AfterDelConfirm
event gets executed. That is, I can't trap it with the debugger. I do have
code in both procedures but there is no evidence that the code gets executed.
After running the Delete button code, the data on the main form is deleted
but the data on the subform remains. (My code is supposed to delete the
subform data in the BeforeDelConfirm event).
I understand that the Tools ==> Options ==> (Edit/Find tab) ==> "Confirm
Document Deletions" checkbox must be true (checked) or the system suppresses
the BeforeDelConfirm/AfterDelConfirm events. I've checked both in the
Options dialog box and in the code, and the option is true.
The Delete event itself has a Cancel option, and I've checked that the
option is set to false (numeral zero).
I'm pretty stumped. Can anyone think of a circumstance in which Delete
fires but BeforeDelConfirm and AfterDelConfirm will not execute?
Thanks!
Marty
I have a main form/sub form arrangement that includes a "Delete" command
button on the main form. The main form shows one record from one table and
the subform shows related records from a different table. Both recordsets
are contained in one transaction. The delete button is intended to delete
all records in the display. When the command button is clicked, the code
that gets executed is:
If Me.Dirty Then
Me.Undo
End If
If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord
End If
Before the second "End If" gets executed, the system fires a Delete event
and the Form_Delete procedure gets control. There is no code in this
procedure, but I put it in just to check that it does get trapped by the
debugger. However, neither the BeforeDelConfirm event or the AfterDelConfirm
event gets executed. That is, I can't trap it with the debugger. I do have
code in both procedures but there is no evidence that the code gets executed.
After running the Delete button code, the data on the main form is deleted
but the data on the subform remains. (My code is supposed to delete the
subform data in the BeforeDelConfirm event).
I understand that the Tools ==> Options ==> (Edit/Find tab) ==> "Confirm
Document Deletions" checkbox must be true (checked) or the system suppresses
the BeforeDelConfirm/AfterDelConfirm events. I've checked both in the
Options dialog box and in the code, and the option is true.
The Delete event itself has a Cancel option, and I've checked that the
option is set to false (numeral zero).
I'm pretty stumped. Can anyone think of a circumstance in which Delete
fires but BeforeDelConfirm and AfterDelConfirm will not execute?
Thanks!
Marty