Okay thanks. I will look up how to do that later on to see if I can figure that out.
Okay thanks. I will look up how to do that later on to see if I can figure that out.
Just a hint - it would require a flag which is set in the Before Update event which the Unload event would then check.
Let me throw out the logic that I am thinking and let me know if I am close or way off here.
So, I suppose I need to add another Else If statement to cover if Cancel is clicked and set it to, say, true. Then in on unload I need to check that flag to see if it is true and if it is, then do not close the form?
But wait, these are private subs, so the variables can't be passed among one another right? Or am I off there as well?
Mike
Close - a Select Case statement would be better than a bunch of If's and/or elseifs.
And you are correct about the checking of the flag and then you would issue a
Cancel = True
in the Unload event.
Scope is something to be aware of. When you have a form module, you can declare it private but that limits the scope to the form module itself. So, while you have a variable that is declared
But wait, these are private subs, so the variables can't be passed among one another right? Or am I off there as well?
Private blnNoClose As Boolean
in the General Declarations Section of the form. Then it can be accessed by any event in that form. When it is declared inside a procedure, then it is only available to that procedure. But since you would declare it in the General Declarations Section (up just below where the Option Compare Database and Option Explicit are at) then it can be used by any event there in THAT form.