Strange message when I call a function from master form

ferrisferris Member Posts: 23
I have a form (Baseform) with a subform (SubForm).
In the SubForm I have create a function (SubFormFunction) that mark some row and show only the marked row.
If I call SubFormFunction from SubForm all works fine but I want to call the SubFormFunction from the BaseForm with the command:

currForm.SubForm.FORM.SubFormFunction()

All works but, before the result, each time I receive a message like this:
"Do you want to rename the Record" (Yes/no) (or something similar, I have navision in Italian language).
If I press No, all works, otherwise I receive a strange error.

If I call 2 function I receive 2 questons and so on.

Does someone know why?

Comments

  • kinekine Member Posts: 12,562
    You need to call CurrForm.UPDATE(False) in your subform, because when you are processing the Rec in the subform (filtering out some records etc.), the actual position of the Rec is still on osme record and the "Main" form will try to save the value... You need to "cancel" any modifications through CurrForm.UPDATE(False)...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ferrisferris Member Posts: 23
    Ok, I understand the problem, but it still don't work well :cry:
    I put the update in the subForm, as you said:

    SubFormFunction:
    MARKEDONLY(FALSE);
    Rec.FIND('-');
    REPEAT
      IF Rec.nome = '?????' THEN
        Rec.MARK(TRUE);
    UNTIL Rec.NEXT = 0;
    MARKEDONLY(TRUE);
    

    and in the main Form (Baseform):
    CurrForm.UPDATE(FALSE);
    CurrForm.subForm.FORM.SubFormFunction();
    

    but I receive the same message in both case.
  • kinekine Member Posts: 12,562
    You need to call it in your subform function, not on the Main form... Add it to the end of your function...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ferrisferris Member Posts: 23
    OK, PERFECT!!!!

    Thanks very much!
Sign In or Register to comment.