What Mode is Modal?

ListO

Señor Member
Local time
Today, 02:27
Joined
Feb 2, 2000
Messages
167
Greetings to all..

I'm trying to create a custom dialog box which can be called from a procedure.

The procedure that calls the custom dialog box is runing through a for-next loop which is cycling through records looking for certain values. When a record with that value is found, I want to call up the dialog box, have the user make a choice, act according to that choice, then loop onward.

I thought that a modal form (the dialog box) would pause execution of the for-next loop until such time as the modal form was closed, but this is not happening. Am I deluded about the nature of modal forms, or is there something different I should be doing?

Thank for the help.

-Curt
I've made the dialog box modal and pop-up.
 
(I think) that a process will continue to run behind a modal form, but you just can't get at it with the mouse pointer.

If you want to pause execution of the process behind, one way would be to use a public boolean variable (let's call it MyWait) and use this to determine whether the process should continue or not, so, in your main form, you'd have:

Code:
MyWait = true
'(your code to Open the dialog box here)
While MyWait = True
Wend
'(continue the process)
Just remember that the completion of the dialog box (the close button or whatever) needs to set MyWait to False

HTH

Mike
 
Thanks for the suggestion. HOWEVER, this does not work because execution continues looping through the While/Wend loop and focus never gets to the dialog box.

I had to force-break out of it because there's no way to reset the MyWait variable to FALSE.
 
OK, OK, I found it myself!

An hour of digging in the helpfiles and here's a quote from helpfile that describes what I should have done:

1 Create a macro or event procedure that uses an OpenForm action to open the form.
2 Set the Window Mode argument of the OpenForm action to Dialog (acDIALOG for an event procedure).

It's that acDialog setting that makes everything wait for the form to close. No While/Wend loop required.


-Curt
 
Nice one, and sorry about the bum advice; I tried it myself (after recommending it), and you're right; the while/wend chews up all of the clock cycles and the other process never starts.
 

Users who are viewing this thread

Back
Top Bottom