Delete not triggering event?

J

Judy

I have a subform in datasheet view. When the user deletes
a row from the subform I want some code to execute. I
have not been able to figure out what event to use. I
have put debug messages in several form events and none of
them are being triggered by the delete
(Form_AfterDelConfirm, Form_AfterUpdate,
Form_DataChange). I have also tried an event for the
field that is being deleted (txtPrjctStBgnDt_AferUpdate).

Can anyone help me figure out where to put my code to get
it to execute after a delete?

Thank you,
Judy
 
B

Bruce M. Thompson

I have a subform in datasheet view. When the user deletes
a row from the subform I want some code to execute. I
have not been able to figure out what event to use. I
have put debug messages in several form events and none of
them are being triggered by the delete
(Form_AfterDelConfirm, Form_AfterUpdate,
Form_DataChange). I have also tried an event for the
field that is being deleted (txtPrjctStBgnDt_AferUpdate).

The AfterDelConfirm event should be triggered - I use it frequently. Here is
an example of the code in such a procedure that runs code after a record has
been deleted:

'******************EXAMPLE START
Private Sub Form_AfterDelConfirm(Status As Integer)
Select Case Status
Case acDeleteOK
'The code runs here if record was deleted
MsgBox "The record was deleted."
End Select
End Sub
'******************EXAMPLE END
 
J

Judy

I copied your exact code into the code module for my
subform. The row was deleted from the table, but the
MsgBox did not pop up. Can you think of any reason why
this might be happening or is there anything else I can
try?

Thank you,
Judy
 
J

Judy

I found out why the event is not being triggered. Under
Tools --> Options --> Edit/Find tab --> Confirm --> Record
Changes is not checked in my Access application.

I can check this box in my application, but what if the
user does not have this box checked (the code would not
get executed)? Any suggestions?

Thank you for your help,
Judy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top