It happens that paul cain formulated :
For the sake of other users with 1 form closing the parent form.... I have
had this same problem with vba Excel, my program is driven entirely from my
MainForm which is modeless but subsequent forms opened from it were modal. I
have had an intermittent problem with MainForm closing when the modal form
closes. MainForm closes (or disappears, I am not really sure what has
happened to it) without even triggering the QueryClose event. By
intermittent, I mean some code has the problem, some doesn't, and I do not
know what the significant difference is between the codes except perhaps that
the code that does crash is usually under development still, not fully
debugged. I have only found 1 fix as mentioned in this discussion, and that
is to make all forms modeless. It is not possible to simply interchange them
from modal to modeless on the run. However, it is possible to add
MainForm.Enabled = False when I open the secondary forms to prevent the user
changing the data in MainForm, then reset it True after the second form is
unloaded. In practice, I had to reset it within a QueryClose sub in case the
user presses X box to close.
I'm inclined to agree with Tom Ogilvy's suggestion to hide userform1
while userform2 is in use, then unhide userform1 when code resumes.
That concept works for me!
What you might want to pay attention to is whether ScreenUpdating is
turned off anywhere, AND/OR whether a DoEvents function is needed.
--
Garry
Free usenet access at
http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc