hello,
I encounter a strange problem on a V5 sql (i have not try yet on an other version).
i have a form with a field with a lookup which call a form with a subform. The subform needs to be filter on a date range present on my first form. So i have create 2 functions (one in the form called by the lookup, one in the subform) to transfer the date range.
example :
code in the lookup of the field
Myform.SetDateRange(StartingDate,EndingDate);
Myform.RUN;
code in the function setdaterange of Myform
CurrForm.SubForm.FORM.SetDaterangeOnSubform(StartingDate,EndingDate);
in the SetdateRangeOnSubform function, I only apply date filters.
The result is OK, the subform is correctly filtered with the two dates but a very strange thing appears :
The form and subform seem to be separated, as if the subform was called directly. Moreover, the task bar of Navision disappears (File/Edit/Tools etc... unavailable)... This is strange !
Somebody can help me?
Thank you !
Nicolas
0
Answers
Pass the parameters to Global Vars in your main form and the call the subform function from a trigger like OnAfterGetCurrentRecord to see what happens...
But can you explain why my way doesn't work?
I had a function in a subform that used CurrForm.UPDATE and CurrForm.UPDATECONTROLS, and the function was called by another function (let's name it InitForm) in the parent form; the InitForm function was sometimes called by the OnOpenForm trigger of the parent form (which yielded the correct behavior) and sometimes from code in other NAV objects (which caused the same issue nromain had).
The solution was to ensure that the InitForm function was never called if the form was not open; this was achieved by ensuring that the only code calling the InitForm function was the OnOpenForm trigger of the parent form.