Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'yes'-'no'-'cancel' dialog

Status
Not open for further replies.

slowface

Programmer
Jul 7, 2003
6
BE
Hi,

I am looking for a way to make a confirmation dialog like 'are you sure you want to save and exit?' No-Yes-Cancel

I guess there must be an easy way to do it, but I don't find one. I have tried it with another form, but the problem is the calling sub goes on with executing after the confirmation form is opened - I want it to wait for a confirmation message from the new form.

Can anyone help me please?
 
this will do what u want


Private Sub Command1_Click()

stryesnocancel = MsgBox("this is what you want>?", vbYesNoCancel)
If stryesnocancel = vbYes Then
MsgBox "Put your saved code here"
ElseIf stryesnocancel = vbNo Then
MsgBox "Nothing was saved"
ElseIf stryesnocancel = vbCancel Then
MsgBox "Request cancelled"
End If

End Sub


tell me if u need more help
 
Code:
    result = MsgBox("Your Prompt", vbQuestion & vbYesNoCancel)
Select Case result
Case 2 'cancel

Case 6 'yes

case 7 'no
End Select
you dont need the vbQuestion & portion this is by way of demonstration. Interestingly combining types of message box does not always work. vbcritical does not combine with vbyesno and vbyesnocancel in my experience.
 
ok thank you very much guys, it is as simple as I was hoping!! Works perfectly.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top