Subform Running Totals on Mainform

I have a mainform/subform in MBS Navision V3.7. I want to display running totals of values entered in the subform. I am assuming these totals have to be located on the mainform. Is this possible and if so how can it be done ?

I’m pretty sure I saw an answer to this on the old mbsonline site, but I dont seem to be able to access that site anymore.

Hi bob_up

You can create flowfields on the main form to calculate the totals. The problem with flowfields is that they aren’t updated when you enter the lines – you have to activate the main form before the flowfields are updated. You can use the OnTimer trigger to update the flowfields but this can give you other issues.

Regards

Claus

Thanks Claus

What kind of issues … ?

Bob

Hi Bob

You can get strange behavior when users try to update the header record, as the form updates it self from the timer trigger. I would only use the OnTimer update on a header form where users can’t change the header record.

Regards

Claus

You can use Windows Script Host (WSH) , then simulate UP to update the maniform

CreateObject(“WScript.Shell”).SendKeys("’ + Keys + ‘")’);

You can use Windows Script Host (WSH) , then simulate UP to update the maniform.

In the Onvalidate of the subform field add code like

CreateObject(“WScript.Shell”).SendKeys("’ + Keys + ‘")’);

The best solution is to create the totals as fields on the subform. Ideally as simple flow fields. Then ont he sub form, find some where to put them that makes sense to your application. In all cases the biggest issue is making it look nice. I have gone as far in some cases as to move all the buttons onto the sub form to get the totals to show, but sometimes just a bit of space at the top of the sub form is enough.