Run vs Runmodal

I have been writing a couple of I guess you could call modules for the coy I work for. We have done a lot of customization, especially in certain areas. One of the things I can’t figue out is the difference between RUN and RUNMODAL, both for reports and forms. Could someone please give explanation? I know difference between f.RUN(… or r.RUN(… and RUN(formnumber… or RUN(reportnumber… but what is the difference between f.RUN(… and f.RUNMODAL or the difference between RUN(reportnumber… and RUNMODAL(reportnumber …? So far my confusion has not stopped me from doing what I need to do, but my confusion I am sure is prevnting me from doing a particular task efficiently.

Hi Mike! If you RUN a Form (or Report) the form is opened and you can work on that and all other forms shown. IF you RUNMODAL a Form (or Report) the Form is opened and you can not switch to any other Form, until the running one is closed. Regards, Jörg Joerg A. Stryk Apollo-Optik, IT/ERP

Oh, been buggin me for years. Thank you very much.

Hi, The main difference is that with RUNMODAL you can retreive variables from the form/report after it’s complete. These aren’t cleared when running with RUNMODAL. For instance if a report is doing some work and you have a counter in this report that gives info about how many records it has created, then if you start the report with RUNMODAL you can retreive the information in this counter after the report is completed. Best regards Daniel

Hi Mike There are two real differences between run and runmodal. The first is that with runmodal execution of the calling object is stopped until it has finished. With run both objects execute at the same time. So with runmodal you can not switch to the calling form until the form you are working on is closed. The second is that the instance of the object is destroyed when run is called but not when runmodal is called. This means that you can return values from an object with runmodal but not with run. As the instance of the object is preserved with runmodal then you should be careful when you call an object with runmodal more than once as its global variables will still be set to the values of the previous execution. You may need to clear the variable to destroy the instance of the object manually. Paul Baxter

Ah, a light bulb goes off. I can use this difference to clear up a couple of other things too! Thank you very much. This is great.