How can I stop in-line code execution after a Docmd.OpenForm? Thanks.
Open the form as Dialog, will halt the code until you close the form
docmd.OpenForm "FormName",,,,,acDialog

Signature
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck
> How can I stop in-line code execution after a Docmd.OpenForm? Thanks.
>How can I stop in-line code execution after a Docmd.OpenForm? Thanks.
Open the form in dialog mode:
DoCmd.OpenForm "formname", . . ., _
WindowMode:= acDialog

Signature
Marsh
MVP [MS Access]
Sorry, guys, acDialog will NOT stop code execution from continuing in the
calling module, although focus will be stuck on the newly-opened form.
The only way to stop execution is by opening the new form - I concede that
acDialog is a good idea - as the last functional line of code in the calling
module (meaning it can be followed by End Function or the like, but not any
new processing).
HTH
>How can I stop in-line code execution after a Docmd.OpenForm? Thanks.

Signature
Sam
Rob Oldfield - 21 Dec 2005 21:33 GMT
errrmmm.... yes it does.
> Sorry, guys, acDialog will NOT stop code execution from continuing in the
> calling module, although focus will be stuck on the newly-opened form.
[quoted text clipped - 7 lines]
>
> >How can I stop in-line code execution after a Docmd.OpenForm? Thanks.
Marshall Barton - 21 Dec 2005 23:06 GMT
>Sorry, guys, acDialog will NOT stop code execution from continuing in the
>calling module, although focus will be stuck on the newly-opened form.
[quoted text clipped - 3 lines]
>module (meaning it can be followed by End Function or the like, but not any
>new processing).
Can you provide a demonstration where acDialog does not
suspend execution in the calling module?

Signature
Marsh
MVP [MS Access]
John Lane - 22 Dec 2005 15:11 GMT
I tried acDialog and it didn't stop inline code execution. Here's how I did it:
Global_Gate = 1
DoCmd.OpenForm "AlreadyImportedWarning", acNormal, , , acFormReadOnly, ,
FileName
Do While Global_Gate = 1
DoEvents
Loop
The Do loop localized it and the DoEvents gave time back to the operating
system so the opened form got time to also execute. Then in the opened form's
Close event I open the gate (set it to 0). Works great.
> >Sorry, guys, acDialog will NOT stop code execution from continuing in the
> >calling module, although focus will be stuck on the newly-opened form.
[quoted text clipped - 6 lines]
> Can you provide a demonstration where acDialog does not
> suspend execution in the calling module?
Marshall Barton - 22 Dec 2005 15:41 GMT
Well, that will work, but it's the long way around the
problem. I am more interested in the acDialog you tried
that didn't work. Could you post that code so we could see
the circumstances that are forcing you to use a less than
optimal approach?

Signature
Marsh
MVP [MS Access]
>I tried acDialog and it didn't stop inline code execution. Here's how I did it:
>
[quoted text clipped - 20 lines]
>> >module (meaning it can be followed by End Function or the like, but not any
>> >new processing).
Albert D.Kallal - 23 Dec 2005 21:08 GMT
> Sorry, guys, acDialog will NOT stop code execution from continuing in the
> calling module, although focus will be stuck on the newly-opened form.
No,the above explains a model form, which is MUCH different then a acDialog
form.
> The only way to stop execution is by opening the new form
Hum....that is exactly what everyone is saying!!...Open a form in
acdialog..and the code will halt.
In fact, using acDialog forms is one GREAT way to build prompt forms that
can RETURN values
without having to use global vars.
I explain how this works here:
http://www.members.shaw.ca/AlbertKallal/Dialog/Index.html

Signature
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.members.shaw.ca/AlbertKallal