Delete confirm

  • Thread starter Thread starter Chris
  • Start date Start date
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
 
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.
 
Back
Top