cancel event

G

Guest

Hi:

I included a SendEmail event in the OnClose of a Main Form. I have Cancel
cmdbutton in the form in case the user doesn't want to proceeed. How can I
bypass the Onclose event? Thanks.
 
W

Wayne Morgan

You can cancel the Unload event, but not the Close event of the form. In the
form's Unload event, if you enter the line

Cancel = True

the form won't close.
 
G

Guest

Thanks for the prompt response.
What I want to do is to cancel the event that is incorporated in the OnClose
event of the Form. That is, if certain criteria was not met the codes will
not be executed.
 
W

Wayne Morgan

In that case use an If...Then statement before the code.

If Criteria = Whatever Then
'Execute your code here
End If
 
G

Guest

So simple. Thanks again.
--
Allan


Wayne Morgan said:
In that case use an If...Then statement before the code.

If Criteria = Whatever Then
'Execute your code here
End If
 

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