You could try something like this:
If MsgBox("Terminate?", vbOkCancel) = vbOk Then
DoCmd.RunMacro stDocName
End If
But there are numerous other issues that could affect the number of
confirmation dialogs the user would have to deal with here.
If this button is to delete the record, you could try something like this:
If Me.Dirty Then Me.Undo
If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord
End If
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"arnold" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a macro in Access that I want to run when someone clicks a
> command button. The code is as follows:
>
> Private Sub Terminate_Click()
> On Error GoTo Err_Terminate_Click
>
> Dim stDocName As String
>
> stDocName = "Terminate"
> DoCmd.RunMacro stDocName
>
> Exit_Terminate_Click:
> Exit Sub
>
> Err_Terminate_Click:
> MsgBox Err.Description
> Resume Exit_Terminate_Click
>
> End Sub
>
> I would like to add a confirmation dialog box to confirm that the user
> wants to terminate the record. How do I add that to the code to make
> it work? If they click "no" I want it to return to the record. If
> they click "yes" I want to it run the macro. Any help would be
> appreciated!