Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not necessarily recommending this for the current problem (though it may be a solution), but it can come in handy in some situations, and that's to open a form with acDialog + acHidden, change its properties, and then set .Visible = True. This causes the form to become modal at the point it appears, rather than at the point it's opened. That is, the code runs up until the point the form is set to .Visible and than pauses, just as it would with only the acDialog argument in the OpenForm command:</p> <pre><code> DoCmd.OpenForm "dlgMyDialog", , , , , acDialog +acHidden With Forms!dlgMyDialog !cmbMyComboBox.Rowsource = ... !cmdClose.Tag = "Modal" .Visible = True ' &lt;= code pauses here End With </code></pre> <p>This is something you can use when you need to open a modal form (with acDialog) from another form opened with acDialog. That is, open the new dialog with acDialog + acHidden, and in the OnOpen event of the child form set .Visible = True and the parent (i.e., calling) form's .Visible = False. To restore the calling form to dialog mode, set the calling form's .Visible = True in the child form's OnClose event.</p> <p>The drawback of this approach from my point of view is that the two forms have to know too much about each other. I prefer that the dialog form be usable from multiple contexts, which means no hardwired references to any of the forms that might call it (and it might be called in a code-only context, rather than from another form). But when you need to do this kind of thing, it's a way to get it done.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload