MsgBox 'Cancel' Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I think I need to put some outcome code in for a Message Box if the user
selects 'Cancel'. At the moment it is going ahead and running the query
regardless.

Any help!?!?!

Private Sub Command62_Click()
On Error GoTo Err_Command62_Click

Dim stDocName As String
X = MsgBox("Are you sure you want to delete ALL Episode data? This process
is irreversible!", 1 + 48, "WARNING")

stDocName = "Deletes ALL MASTER data"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command62_Click:
Exit Sub

Err_Command62_Click:
MsgBox Err.Description
Resume Exit_Command62_Click
 
Hi,

I prefer this method, works quite well.

If MsgBox("text", vbYesNo + vbQuestion, "title") = vbYes Then
run code
Else
DoCmd.CancelEvent
Exit Sub
End If

Good Luck

Dan
 
Back
Top