Closing a Form

ERPERP Member Posts: 20
Hi Guys,

Solved this issue in a simple way.
Just made the Form 1 invisible and called Form 2 using RUNMODAL.
So, Now Form 2 will have focus and as for the user is concerned he is not able to see the Form1 and is allowed to continue work on Form2.

Thanks all for your valuable sharing knowledge. :D

Answers

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Try creating a function in Form2 which contains the statement:
    CurrForm.CLOSE;
    
    Then call this function from Form1 in the OnOpenForm-trigger.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • garakgarak Member Posts: 3,263
    Why this?

    When you run form2.runmodal the form2 became the focus,will be opend and form1 can not became an focus and no transaction will run.
    The user can't change the record in form1

    When you set an

    Form2.runmodal;
    CurrForm.close(); //Form1

    The form 1 wll be closed when form 2 is closed.
    Do you make it right, it works too!
  • ERPERP Member Posts: 20
    Hope my question was mistaken.
    I have to open Form2 form Form1. At the same time I have to close Form1 making Form2 in open state.

    Thanks.
  • jonsan21jonsan21 Member Posts: 118
    Hi,

    Are you trying to make Navision works like a Web based form? :)

    Anyway, I've done this before.

    1. Create a form called "Form 1", with a command button, and in the OnPush Trigger, put CurrForm.CLOSE;

    2. Create a form called "Form 2", just a blank Form will do for this example.

    3. Create a Codeunit, say Codeunit1, OnRun Trigger, put FORM.RUN(FORM::"Form 2");

    4. Go Back to "Form 1", at the OnCloseForm Trigger, put Codeunit1.RUN;

    I believe this will achieve your objective :D

    Rgds,

    Jon.
    Rgds,

    Jon.
  • WiLLy_CoYoTeWiLLy_CoYoTe Member Posts: 7
    ERP wrote:
    Hope my question was mistaken.
    I have to open Form2 form Form1. At the same time I have to close Form1 making Form2 in open state.
    Thanks.

    You just use FORM.RUN function.
    OnPush: //Form1
    FORM.RUN(FORM::"Form 2");
    CurrForm.CLOSE;
    

    So... when you open "Form 2" Navision close immediatly "Form 1".
Sign In or Register to comment.