Options

Simple problem but disturb me !!

AngeloAngelo Member Posts: 180
Hello, Master Navision...

I have a simple problem
When I lookup a form :


IF FormA.RUNMODAL = ACTION::LookupOK THEN BEGIN
IF A THEN BEGIN
<do something>
END ELSE ERROR(text0001);
END;

When Error appear,then I click OK, FormA will disappear. I want it remain appear. How Can I do that ?

Anyone can help me? :wink:

Comments

  • Options
    jemmyjemmy Member Posts: 247
    Hi Angelo,
    IF FormA.RUNMODAL = ACTION::LookupOK
    
    means that you are closing the FormA by press ok.

    If you use ERROR then system will terminate all executions of C/Al codes.
    It means that it is the end of your codes.
    Then all your codes which try to open FormA will be ignored.

    hope this helps, :wink:

    Jemmy
  • Options
    AngeloAngelo Member Posts: 180
    :cry:

    it means that we can't handle it and let it will be like that....
    my scenario :
    when FormA.runmodal from coding in formB, FormA will appear n user must fill something completely, if not complete, there is an error appear n I want FormA dont disappear, so the user can fill again without click something for enter formA again....

    :wink:
  • Options
    ArhontisArhontis Member Posts: 667
    Hi Angelo,

    You could place the check inside FormA in the OnQueryCloseForm and disable the form from closing in case data are not complete, or you could replace ERROR( with MESSAGE( and use a repeat statement like:
    A:='';
    REPEAT
      IF FormA.RUNMODAL = ACTION::LookupOK THEN BEGIN 
        IF A THEN BEGIN 
          <do something> 
          END 
          ELSE MESSAGE(text0001); 
        END; 
      END;
    UNTIL A<>'';
    

    I suggest you use the first suggestion...
  • Options
    AngeloAngelo Member Posts: 180
    :lol::lol::lol:

    Hi, Arhontis.....

    That's Great Man !!!!

    Thx...
Sign In or Register to comment.