Stop Code Execution

  • Thread starter Thread starter Guest
  • Start date Start date
Open the form as Dialog, will halt the code until you close the form

docmd.OpenForm "FormName",,,,,acDialog
 
John said:
How can I stop in-line code execution after a Docmd.OpenForm? Thanks.


Open the form in dialog mode:

DoCmd.OpenForm "formname", . . ., _
WindowMode:= acDialog
 
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
 
errrmmm.... yes it does.


OfficeDev18 via AccessMonster.com said:
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
 
OfficeDev18 said:
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).


Can you provide a demonstration where acDialog does not
suspend execution in the calling module?
 
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.
 
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?
 
OfficeDev18 via AccessMonster.com said:
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
 
Back
Top