Update/Refresh MainForm from SubForm

I have 2 forms, “MainForm” and “Subform”. From the MainForm I call SubForm, and the SubForm changes a field that is shown on MainForm. When I close the SubForm and gets back to Mainform, Mainform shows the old value of the field. I have to get out/in of the Mainform, to see the newvalue. Is there a Form.REFRESH(MainForm) or anything I can use ?

Michael, I think what you are looking for is ‘CurrForm.UPDATE’. Just try it. Sebastien

I can’t use CurrForm.Update, since the updating is done from the subform. On the mainform there is a drilldown to the subform, and I can’t figure out how to do the Currform.UPDATE from the mainform when I ‘get back’ from the subform (I know how to do the Currform.UPDATE, but WHEN should I do it, there isn’t a trigger called OnAfterDrillDown…)

Hi, May be you can try making the field to flow field in table for the main form. Just find an eg below, calcformula :=Sum(“table”.field WHERE (condition); “table” =subform table… Rgds, Anu

Michael, I think we discussed this problem some time ago, and as far as I can remember, your only chance is a CurrForm.UPDATE in the main form’s OnTimer trigger[xx(]. I had the same requirement a few weeks ago, and it’s still unsolved. Using the OnTimer trigger should be considered a last resort, IMHO.

Heinz is right! We tried to use OnTimer as well, but that was definitely not the solution, as this trigger slows the system down. And it makes it almost impossible to debug the form!! Furthermore you can “never” trust the flowfield on the mainform as it is only updated according to the TimerInterval. Our solution was to create a control on the subform and handle it as the balance-controls in then ledger-journals.

Why are you updating the whole form. Just create a flow field in the Header, and then in the OnTimmer trigger put the followingCaclfields(MyFlowField); CurrForm.MyFlowField.Update; Then you are only updating one field, not the whole form.

By the way, I regularly do this on the Sales header for the Amount field, and have been doing it for many years without problems. Your biggest problem with a CurrForm.Update, is that it also updates the subform.