Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ACCESS VBA EVENTS

Status
Not open for further replies.

Dilettant

Technical User
Sep 27, 2006
16
US
1. I am deleting a record via
Code:
DoCmd.DoMenuItem acFormBar, acEditMenu, acDelete, , acMenuVer70
2. A message is returned asking if I am sure I want to delete the record.
3. If I click "NO" I get another message: "DoCmd action canceled" with an "OK" button, waiting for a response.
MY QUESTION: IS THERE AN EVENT TRIGGERED BY THAT LAST MESSAGE?
I NEED TO UNDO THINGS DUE TO THE OPERATOR CHANGING HIS MIND.
 
When you click No and get "DoCmd action canceled...", is the record deleted anyway? If not, it appears to be functioning properly.
If you click "Yes", is the record gone?

Let them hate - so long as they fear... Lucius Accius
 
It does function properly: on "yes" the record is deleted, on "no" it is retained. My problem is I need to run a procedure after clicking "no" and I need an event to start it. I thought the message "DoCmd action canceled" would provide it. Does it?
 
maybe try the Access Form Events, to achieve what you want

OnDelete
BeforeDeleteConfirmation
AfterDelete Confirmation

or create your own form...
 
I tried on delete, it doesn't work. delete from I understand that before and after deleteconfirmation don't happen if canceled.
What do you mean by "or create your own form?
 
Private Sub Form_AfterDelConfirm(Status As Integer)
'2 = No 0 = yes
If Status = 0 Then
MsgBox "Yes"
Else
MsgBox "No"
End If
End Sub


or create your own form.
On Main form, add button labeled "Delete"
When clicked, it opens a popup form, with
Message saying, "Do you want to Delete Current Record..."
With 2 buttons, "yes","No", write your code behind each button...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top