Close form cancelling

  • Thread starter Thread starter Luke Bellamy
  • Start date Start date
L

Luke Bellamy

Hi,
I have a form and when the user exists (either by my "close" button or
via the "x" in the top right hand corner) I ask for confirmation to see if
they
are sure they wish to exit. If they choose no I wish to stop closing the
form.

So in the Form_Unload event I have code that shows a vbYesNo msg box
and the following code doesn't seem to stop the form unloading:

if varConfirm = vbNo then
Cancel = TRUE
exit sub
end if

I am 100% sure this 'if' block is being executed. The funny thing is I have
a similar
thing on another form an it works OK. Anyone know of any reasons why it
wouldn't
work or another way I can do it?

Thankyou
 
Back
Top