Delete Button warning

ledgerr.rob

Registered User.
Local time
Yesterday, 20:25
Joined
Jun 3, 2012
Messages
68
Windows Vista
Access 2007

I have added a button to a form that would delete a record. This works just fine.

I would like to add a confirmation that this is something that i'd like to do.

I'm not sure if this is goes in the form forum or the or the vba forum?

Thanks for any pointers.
rob
 
Last edited:
in your form select your command button and choose properties. In the "on click" event, open the builder ... The macro window will open. enter or choose "MessageBox" from the drop down list for macro. Enter the message you wish to display when someone clicks the button, Beep is defaulted to Yes, type none and you may add a title that appears on the top of the warning window.

I hope this makes sense.
 
You could use something like this.

Code:
Dim Msg As String, BoxResponse As String
Dim Title As String, Style As Integer
Msg = "Are you sure you want to delete this Record?"
Style = vbYesNo + vbExclamation
BoxResponse = MsgBox(Msg, Style, Title)

If BoxResponse = vbYes Then
     DoCmd.SetWarnings False
     DoCmd.RunCommand acCmdSelectRecord
     DoCmd.RunCommand acCmdDeleteRecord
     DoCmd.SetWarnings True
     Exit Sub
Else
     Exit Sub
End If

Catalina
 

Users who are viewing this thread

Back
Top Bottom