Of course, you realize that sub-form is just a control on the parent form.
So, when you set a form as model, then of course the sub-form being part of
the form is also model.
However, you do NOT want to confuse model forms (which you set in the other
tab in design mode) with that of acDialog forms.
The model setting is not controlled via code. You simply set this setting in
the "other" tab, and can then either open a form in via code, or simply by
clicking on it in the ms-access UI, and the model setting is RESPECTED!. In
fact, you CAN NOT control this setting via code for all intensive purposes.
And, you should be clear on the fact that opening a form in acDialog mode is
COMPLETELY a different issue, and different process from model forms.
(using the acDiglog option is rather nasty,a nd that option halts all code,
in including forms calling code...and you can't even use the built in menus
(in fact, you can't even use custom menus either. So, don't confuse acDialog
with model). An acDialog form is much like the MsgBox command, in that
nothing else can get, or have the focus until you dismiss that dialog. A
model form has NO such behaviors at all. A model form simply keeps the
focus, but your code continues to run (and custom menus etc. continue to
function as normal). And, the calling code that opened the model form
continues to run, and can even assign values etc. to the MODEL form!
However, that model form DOES keep the focus, and it has to be closed BEFORE
you are able to return to the previous form.
So, there is a huge difference, and huge reasons as to when, and not when to
use a acDialog form VS a model form. They are very different animals, and
thus while very few of my forms are acDialog, about 80-90% are model.
The use of the model setting is CRITICAL to program flow. If a form is set
to model, and it opens another form that is ALSO to model and so on, then
you will be forced to exit out the in the reverse order.
Likely what is happening is the first form is not set to model..and it
should be.
And, if it is set to model...it likely is also set to popup..and that should
NOT be the case!
I have a main popup form that is set to modal
A main form that is model makes sense...but no the fact that it is popup? (I
am now confused).
Just make the main form a regular form..and in the other tab set it to
model....
and it works great, it won't let you do anything else outside of it. But
I
also have a small popup form with a subform on it that comes up (when they
click on a button back on the main form) and that form doesn't seem to
work.
This form that pops up should also be model...and you don't need it to be
popup. This form will keep the focus until the user closes it. The user
should NOT be able to get back to the main form until it is closed.
I suspect the issue here is the popup setting..as that setting gets confused
with a model setting (popup means to remain on top...and allow other forms
to open. It does NOT make sense to have a form that is popup and
model.........). A form when launched is always on top if it is model.
However, a form with a popup stetting STAYS on top EVEN when additional
forms are launched..and thus model don't make sense at all!
And, as mentioned, the above issues for the model setting are not to be
confused with acDialog forms (which can ONLY be set via the OpenForm
Method)..and should not be confused with popup, or model forms.
So, remove all popup settings...and just stick with model....