Multi subforms

HenningThHenningTh Member Posts: 59
Have a problem which seems to be difficult to solve:

Having a main-form containing 2 sub-forms. These 2 subforms refers to 2 different tables. When I call the mainform I have 2 variables for filtering (one variable for each of the subs).
To use SETTABLEVIEW and SETRECORD for each of the subforms gives an error when calling the main-form - you are not allowed to use more than one.

HAve elaborated over this, but cannot find the solution - anyone who can? Would be very greatfull for any help on this matter.

Comments

  • MBergerMBerger Member Posts: 413
    I don't see any problems with your setup, you should be able to link 2 subforms to one main form easily, either via the subformlink or via functions in the subforms you can cal to set your filters. What problems are you experiencing exactly, and can you show us any code ?
  • krzychub83krzychub83 Member Posts: 120
    MBerger wrote:
    I don't see any problems with your setup, you should be able to link 2 subforms to one main form easily, either via the subformlink or via functions in the subforms you can cal to set your filters. What problems are you experiencing exactly, and can you show us any code ?

    I think he has a main form with a subform and in that subform a second subform, which is not allowed in NAV. So not a form with two subforms, but a form with a subform, which has a subform on it.
  • HenningThHenningTh Member Posts: 59
    Have rechecked my code - a little embarrassed to admit a spellig flaw :oops:
    No error anymore, but subform 1 (LocalStock) shows correct limited view - but subform2 (vendorstock) just shows all existing items (no filter).
    MainStockform contains both LocalForm and Vendorform


    Code:

    IF "Own product" <> '' THEN
    BEGIN
    LocalStock.SETRANGE(Productkode,"Local product");
    IF LocalStock.FINDFIRST THEN
    BEGIN
    LocalForm.SETTABLEVIEW(LocalStock);
    LocalForm.SETRECORD(LocalStock);
    END;
    END;

    IF "Produkt-ID" <> '' THEN
    BEGIN
    VendorStock.SETRANGE(ProductID,"Produkt-ID");
    IF VendorStock.FINDFIRST THEN
    BEGIN
    VendorForm.SETTABLEVIEW(VendorStock);
    VendorForm.SETRECORD(VendorStock);
    END ELSE
    CLEAR(VendorForm);
    END;

    MainStockform.run;
Sign In or Register to comment.