By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,145 Members | 1,630 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,145 IT Pros & Developers. It's quick & easy.

can I do this some how?

P: n/a
ken
I'm in a form. I click a button to open a form. Within the onclick sub
there is code to open a form. I want that sub to wait until the user
completes his work on the newly opened form, then continue running the
sub. Does this make sense?

I tried with a while loop but that didn't work...

sub onclick_open_form

'open myform

'wait until the user is done with myform
do until not CurrentProject.Forms("myform").isloaded
loop
'once done loop terminates and we can go on here
'more code here...
end sub

Dec 28 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
If you make the form "Modal", I believe the code halts until the modal
form is closed. Don't quote me on that, though.

You could always split the code and have part of it run when the form
opens and part of it run when the form closes, unless you need to carry
variable values. Even so, I think you can carry them using Global
variables.
ken wrote:
I'm in a form. I click a button to open a form. Within the onclick sub
there is code to open a form. I want that sub to wait until the user
completes his work on the newly opened form, then continue running the
sub. Does this make sense?

I tried with a while loop but that didn't work...

sub onclick_open_form

'open myform

'wait until the user is done with myform
do until not CurrentProject.Forms("myform").isloaded
loop
'once done loop terminates and we can go on here
'more code here...
end sub
Dec 28 '06 #2

P: n/a
ManningFan wrote:
If you make the form "Modal", I believe the code halts until the modal
form is closed. Don't quote me on that, though. [snip]
Close, but incorrect. If a form is opened with the acDialog argument of the
OpenForm method then it will behave as if both the Popup and Modal properties
are set to True AND it will cause the code that opened it to pause execution
until the form is closed or set to hidden.

Neither the Modal, Popup, or combination of both properties will cause code to
pause if the acDialog argument is not used.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Dec 28 '06 #3

P: n/a
ken
BRILLIANT!

Rick Brandt wrote:
ManningFan wrote:
If you make the form "Modal", I believe the code halts until the modal
form is closed. Don't quote me on that, though. [snip]

Close, but incorrect. If a form is opened with the acDialog argument of the
OpenForm method then it will behave as if both the Popup and Modal properties
are set to True AND it will cause the code that opened it to pause execution
until the form is closed or set to hidden.

Neither the Modal, Popup, or combination of both properties will cause code to
pause if the acDialog argument is not used.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Dec 28 '06 #4

P: n/a
Do you work for Guinness? ;o)

ken wrote:
BRILLIANT!
Dec 28 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.