Hi,
i'm receiving the error when i try to execute a method from my subform.
In the onAfterGetCurrRecord i'm calling this method from my subform:
Form - OnAfterGetCurrRecord()CurrForm.GrondstofSUB.FORM.FillFilters(FabricatieID,Fabricatienr);
CurrForm.GrondstofSUB.FORM.FillGrondStofSamenStelling();
The error occurs in the FillGrondStofSamenStelling() method.
This method looks like the following:
FillGrondStofSamenStelling()
lv_PORegel.RESET;
lv_PORegel.SETRANGE(lv_PORegel.FabricatieID,gv_FabricatieID);
lv_PORegel.SETRANGE(lv_PORegel.Fabricatienr,gv_FabricatieNr);
lv_PORegel.SETFILTER(lv_PORegel.Item,'<>%1','');
IF lv_PORegel.FINDSET THEN BEGIN
REPEAT
IF lv_Item.GET(lv_PORegel.Item) THEN BEGIN
IF lv_Item."Item Category Code" <> 'F' THEN BEGIN
lv_POResultSamenstell.RESET;
lv_POResultSamenstell.ID := 0;
lv_POResultSamenstell.FabricatieID := gv_FabricatieID;
lv_POResultSamenstell.Fabricatienr := gv_FabricatieNr;
lv_POResultSamenstell.SamenstellingType := 'G';
lv_POResultSamenstell.Item := lv_Item."No.";
lv_POResultSamenstell.Omschrijving := lv_Item.Description;
lv_POResultSamenstell.Type := lv_Item."Item Category Code";
lv_POResultSamenstell.Hoeveelheid := lv_PORegel.HoeveelheidKG;
lv_POResultSamenstell.INSERT; END
ELSE BEGIN
// Item is Formule en moet verder opgesplitst worden
lv_Recept.RESET;
lv_Recept.SETRANGE(lv_Recept.ReceptCode,lv_Item."No.");
lv_Recept.SETFILTER(lv_Recept.IsActiefRecept,'TRUE');
IF lv_Recept.FINDFIRST THEN BEGIN
REPEAT
FillGrondStofTable(lv_Recept.ID);
UNTIL lv_Recept.NEXT = 0;
END;
END;
END;
UNTIL lv_PORegel.NEXT = 0;
END;
CurrForm.UPDATE(FALSE);
The error occurs as soon as i try to insert the record (see line in bold)
Anyone see why this would happen?
0
Answers
FillGrondStofSamenStelling()
lv_POResultSamenstell.RESET;
lv_POResultSamenstell.ID := 0;
lv_POResultSamenstell.FabricatieID := gv_FabricatieID;
lv_POResultSamenstell.Fabricatienr := gv_FabricatieNr;
lv_POResultSamenstell.SamenstellingType := 'G';
lv_POResultSamenstell.Item := '1021';
lv_POResultSamenstell.Omschrijving := 'Test';
lv_POResultSamenstell.Type := 'G';
lv_POResultSamenstell.Hoeveelheid := 1;
lv_POResultSamenstell.INSERT;
It also generates the error
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Why not if you insert / modify a reord on your base table, then insert / modify the record(s) in your sub table.
So i ask you, what do you want to do :?:
Give us some more infos and we will find the best solution for you
regards
And then display this table in the subform.
It means, make sure, that you generates all records before you open the form and than just filter for the correct one. If you will generate the records each time someone move the cursor, it will not be usable...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.