Dialog Box Halts Processing?

G

Guest

To allow a form to load completely before continuing processing it was
recommended to change the form a dialog. I'm having issues with code
execution and am wondering if the code is being suspended by the dialog box
(which reports progress). Reading about the dialog box I found

"It also disables user-defined key combinations and some other Microsoft
Access function keys and suspends the macro or event procedure until you
close or hide the form. You can hide a form by setting its Visible property
to No using the SetValue action."

Any ideas on how to get the code to continue executing automatically?
 
D

Douglas J Steele

That's referring to code being suspended in what opens the form, not in the
dialog form itself.
 
T

Tim Ferguson

suspends the macro or event procedure until you
close or hide the form. You can hide a form by setting its Visible
property to No using the SetValue action."

Any ideas on how to get the code to continue executing automatically?

The whole point of a Modal form is that the calling code waits for it to
finish -- either by closing or hiding. If you don't want the calling code
to wait, then don't open the form in modal mode.

If you want to give the form more time to complete its opening stuff,
then you can use DoEvents or, if that's not enough, the Sleep API. VBA is
a single thread and can't actually run truly asynchronously. My
impression is that all the forms Open, Load and Current etc events seem
to run before the calling code resumes, but I have not gone out of my way
to test it.

(I've just tested it quickly, and that seems to be the case).

Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top