Requery Sub-forms automatically

rsridhar75rsridhar75 Member Posts: 12
Hi,

I have a sub-form in a form which is linked to a Code field in the main form. When i change value of Code field my sub-form should automatically get refreshed. Iam able to archive this if i go to previous record and come back to next record. Is there any way or any C/AL code to refresh / re-query the sub-form automatically?

Thanks in advance.
Regards,

Sridhar R

Comments

  • tinoruijstinoruijs Member Posts: 1,226
    rsridhar75 wrote:
    Hi,

    I have a sub-form in a form which is linked to a Code field in the main form. When i change value of Code field my sub-form should automatically get refreshed. Iam able to archive this if i go to previous record and come back to next record. Is there any way or any C/AL code to refresh / re-query the sub-form automatically?

    Thanks in advance.

    Create a function UpdateSubForm on the subform.
    Put CurrForm.Update; in the new function.
    Make sure the subform has a name on the main-form.
    Call the function on the subform in the OnAfterValidate of the field on the main form:
    CurrForm.NameSubForm.FORM.UpdateSubForm;
    

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • rsridhar75rsridhar75 Member Posts: 12
    Thanks a lot.
    Regards,

    Sridhar R
Sign In or Register to comment.