title: MS Access: Resizing dialog form from within module
body: <p>I am trying to open a form in dialog mode, and then resize it to a desired size using <code>DoCmd.MoveSize</code> from a module. Ideally I would like this all to run from said module.</p>
  <p>Currently the form opens, but does not get resized. I am guessing this is either because the form is not yet active when the command is being run or because <code>acDialog</code> in the <code>OpenForm</code> command prevents it from being executed. I think I could get away with it plugging the <code>MoveSize</code> command into the <code>OnlOad</code> event of the form but I would prefer having as much of the functionality in the module instead. Is there some way around this issue? Like maybe there is some kind of method to wait for the form to be active or some way to plug a command into the <code>OnLoad</code> event from the module itself? As you can tell I am not too familiar with vba yet. It's part of a little project I am doing. Appreciate any help.</p>
  <p>Some sample code is as follows:</p>
  <p><em>This one does not resize the form:</em></p>
  <pre><code>Option Compare Database
  Option Explicit
  
  Public Function OpenFormDialog()
  
      DoCmd.OpenForm &quot;MsgBoxForm&quot;, acNormal, , , acFormAdd, acDialog
      DoCmd.MoveSize , , , 9500
      
  End Function
  </code></pre>
  <p><em>This one throws an error because the form is not found:</em></p>
  <pre><code>Option Compare Database
  Option Explicit
  
  Public Function OpenFormDialog()
  
      DoCmd.OpenForm &quot;MsgBoxForm&quot;, acNormal, , , acFormAdd, acDialog
      Forms.(&quot;MsgBoxForm&quot;).DoCmd.MoveSize , , , 9500
      
  End Function
  </code></pre>