"De-activate" subform

Hi, I have a situation where I am using 2 subforms on a mainform. There are filters on the main form that determine what is displayed on the first subform. The second subform form displays details dependant on which field is “activated” on the first subform form. I have achieved this by placing non-visible push-buttons over the (variable) text fields on the first subform, and using the “OnPush” trigger to set a return variable for the main form. What I need to do now is “de-activate” the first subform once the button has been pushed, and return control to the main form so that I can then use the returned variable to select and display the details in the second subform I have temporarily achieved this by using a “Refresh” button on the Main form, but would like to be able to automate this so that the user only has to select the button on the first subform, and the rest happens “behind the scenes”. Is this possible?? Many Thanks, Veronica

Hi Veronica, have you searched the forum? There have been some threads about two subforms. Navisions way of handling the connection between two subforms in a main form is not very good. I think there are two ways: 1: Use the OnTimer-Trigger to get the actual record from the first subform and put it to the second subform in order to set the filters there. 2: Use a SingleInstance-Codeunit, where your mainform is a global Variable. Start your Form from there in a Function. And in the OnAfterGetCurrRecord-Trigger of the first Subform you call a Function in this Codeunit, which calls a Function of your Mainform, which calls the Function of the Second Mainform to set the Filters. But you have to start your Form modal!!! This works very good, if modality is not a problem. Hope this helps. Regards, Frank

In fact it’s a lot much more easy if you create a few functions one on each subform and a couple on the main form using the GETVIEW and SETVIEW properties… and using the main form to synchronize both subforms… :slight_smile:

Hi Alfonso, But how do you handle to set the correct filter in subform 2 if you choose an other record in subform 1? How do the mainform and subform 2 recognize that you have choosen a different record in subform 1? Greetings, Frank

Hi Frank and Alfonso, Many thanks for your suggestions… I think for my purpose Franks’s option 2 sounds best, so will give it a try and let you know how I get on. You are right Frank, the forum is a very valuable reference tool when trying to develop more complex solutions. I have found it very useful. Many Thanks, Veronica

Veronica, Why not using a tablebox together with a subform? That is a lot easier. Roelof.