I have created a custom BeforeDelConfirm dialog box using the following code:
Code:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
' Supress Default Delete Confirmation dialog box.
Response = acDataErrContinue
' Display custom dialog box.
If MsgBox("Are you sure you want to delete this MEF?", vbYesNo) = vbNo Then
No = True
End If
End Sub
And a custom AfterDelConfirm dialog box using the following code:
Code:
Private Sub Form_AfterDelConfirm(Status As Integer)
Select Case Status
Case acDeleteYes
MsgBox "The MEF has been deleted."
Case acDeleteNo
MsgBox "The MEF has not been deleted"
Case acDeleteUserNo
MsgBox "The MEF has not been deleted."
End Select
End Sub
I have a "Delete This MEF?" button that I created with the button wizard.
The problem is, if I want to delete record 1, I click on the delete button, Access advances to record 2 and asks "Are you sure you want to delete this MEF?". If I say "Yes", Access will delete record 1 and continue to show record 2. Is this behavior normal? I would like it to stay on record 1 when it asks it's confirmation message, then advance to record 2 after the delete.
If possible, I would like Access to insert the MEF number to be deleted into the question - "Are you sure you want to delete MEF 1?"
Any help will be highly appreciated.