MsgBox 'Cancel' Code

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
 
G

Guest

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
 

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

Similar Threads


Top