Avoid form beeing closed

Hi [:)] Is it is possible to avoid form2 from beeing closed when form1 is closed? From1 gets input(filtervariable) from the user and opens form2. I’ve heard about the OnQueryCloseForm - trigger, but can I use it… and how? TiA

Isn’t it possible to use FORM2.RUNMODAL on form1 to open form2? This way form2 must first be closed before you can close form1.

You can just put a conditional exit(FALSE) in the QueryCloseForm. But sometimes forms are dependent of each other and will close when the parrentform is closed. Can you provide more info about the context/situation?

Thanks for your replies! I can’t use Form2.RUNMODAL because I would like form1 to close when I open form2. The reason for this is that form2 actually is used as a mainwindow(as Customercard and salesorders). Form2 lists records according to the filter provided by form1. How do I know that it is Form1 that is closing - what kode do I put in the QueryCloseForm trigger in addition to the conditional exit(FALSE)? How do I know if the forms are dependant?

If I understand you correctly you want the forms to behave in a non-navision way. Are you absolutely sure you want to do this? You can make some codeunit that does the handling for you. In this codeunit you can keep track of what forms are open. Otherwise I would advise to train your users to use Navision the way it was designed.

It’s not quite the Navision way, but I had to do it like this to satisfy the customer. Its all the way the Navisionway elsewere! [;)] Thanks Mark, I’ll try to make a codeuit to do the handling.

Hi bror, can you explain in user terms (not code examples) what you are trying ot achieve. i.e. tell us what you want to do, not how you want to achive it, then maybe a better solution can be provided.

Hi David The scenario is like this: user opens the “request- form”, enters a filter in a textboks, push a botton and the main form opens with the filter applied. I would like the “request- form” to disappear and leave the main form open.

Then just copy form 40 which does exactly this.

Thanks, I might do just that [:)]

If you don’t want to copy all the code and everything, then just put a bit of code in the “OnOpenForm” that will open the fitlering form, and here set your filters. Just keep it simple.