Ah, I think I understand now.
What is happening is that you have a button that tells the form to close when it's clicked. To see what it does, put in a breakpoint in button's click then F8 all way through. I'd bet this is what going to happen.
In button's OnClick, the execution moves to the line where form will be closed.
The BeforeUpdate event then fires and takes the execution to the code within BeforeUpdate event, and give you the prompt. You say "No", so the BeforeUpdate fails (e.g. no records is being saved). The execution then returns to the the button's OnClick event and complete the closing of form.
Therefore, you need to have something to tell form to close *only* if it is allowed to.
How exactly to implement this, would depend on how your OnClick event is coded. Maybe if you paste this, we can give some specific suggestions (I have some idea but didn't want to give you wrong one so...)