Delete confirm

C

Chris

Hi

On my form I have a delete record command button. What I
would like is for a message box to appear with Are You
Sure? and YES and CANCEL buttons. Can anyone help me with
the code please?

Thank you very much

Chris
 
R

Roger Carlson

Dim Response As Integer
Response = MsgBox("Are you sure?", vbOKCancel)
If Response = vbOK Then
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True
End If

I assume you don't want the Confirm Delete dialog to pop up after the
delete, so I added the SetWarnings lines. If you DO want the Confirm Delete
afterward, remove these.
 
G

Guest

Ok I have figured it out now and it works just fine thanks
again for your help Roger.
 

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