Get a value from a Mainform in a Subform

I have searched the Forum for help with this, but am stuck. We have Navision 3.01B on SQL server. I have a mainform, and a subform. The SubFormLink property in the mainform specifies a link on order number and line number. In the OnOpenForm trigger of the subform, I want to find out the values of the link fields, and set a filter on the subform records depending on some code. I have tried getting the values from FilterGroup 4 (where a user suggested the link values were passed), but they only seem to be there when you first run the mainform. If you browse to a different record in the mainform, then in the subform OnOpenForm trigger they are not set any more! This is most confusing! I thought of calling a function in the mainform from the subform to get the values, but how do you reference the mainform from the subform? Any help very greatfully received. Andy

Maybe these will help… How To pass parameters between objects (forms, reports, …)? How To pass parameters between objects (forms, reports, …)? Revisited

I did not know about single instance codeunits. But in this case, I reckon it will solve the problem. Many thanks … Andy[^]

I would define a function on the subform that takes parameters passed from the main form to indicate which record from the main form the user is on. This function is responsible for setting the proper filters on the subform (I would use filtergroup 4). Then call this function from the main form in the OnAfterGetCurrRecord trigger.

Its horses for courses raelly, but I normally do it one of two ways. 1/ the way Jack says above. or 2/ I create a flow filter on the main form table, and then set it as a filter on the sub form, then populate it with the value I want to pass.