Subforms

Hi All! I have a form that uses several subforms on multiple tabs. I want to update some values on the main form when the user changes things on the subforms such as adding/deleting records, changing values etc. I have a method that I call (in a codeunit) to do all the computations, and it then updates the record of the main form, but it doesn’t update the controls on the main form (I tried calling UPDATE but it throws and error as it is not the current form…) I also tried creating and calling a method in the main form, which in turn calls the codeunit method. This must be a common requirement - so does anyone know what is the recommended way to about this? Thanks in advance! DD

There most be a dozen topics covering this item.

Do something like this: Enable your ontimer trigger by setting a timer interval in the properties of the main form. Program a currform.update in that trigger. Important, only update the form when something is to be updated. Therefore you will need a boolean. IF UpdateNeeded THEN CURRFORM.UPDATE := False; SetUpdateNeeded(False); // See below for sample UpdateNeeded is a function the that codeunit. This function will return a True or False. This value is set from the subform. UpdateNeeded(); Exit(UpdateMainForm); SetUpdateNeeded(Update : Boolean); UpdateMainForm := Update; Call the SetUpdateNeeded function with value true on modifications in subform. NOW THE MOST IMPORTANT THING!!! Codeunit with thoses functions MUST be SINGLEINSTANCE. This is a propertie. For a sample download a little demo I made some time ago here: mibuso.com : http://www.mibuso.com/dlinfo.asp?FileID=290 or from my website : http://members.home.nl/eromein (Navision / Add-ons) Good luck!

perhaps the following link will help :http://www.mibuso.com/dlinfo.asp?FileID=290