Yes/No MsgBox - Return to Form

G

Guest

I have a simple msgbox with vbYesNo for an "upon close" event. When Yes is clicked it closes the form, which is fine. But, when No is clicked I want it to return to the form instead of closing it. How do I do this?
 
F

fredg

I have a simple msgbox with vbYesNo for an "upon close" event. When Yes is clicked it closes the form, which is fine. But, when No is clicked I want it to return to the form instead of closing it. How do I do this?

The Close event is not the place to do this.
Use the Form's UnLoad event:

Cancel = MsgBox("Are you sure?",vbYesNo,"Closing Form") = vbNo
 
G

Guest

Thank you so much! It works great now.

fredg said:
The Close event is not the place to do this.
Use the Form's UnLoad event:

Cancel = MsgBox("Are you sure?",vbYesNo,"Closing Form") = vbNo
 

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