View Full Version : Sum Problem


HannahLott
04-26-2002, 04:17 AM
I have a main form (TotalStockValue) with four sub forms (AssStock, MatStock, ProStock, ExtStock)on it all the sub forms are datasheets with a footer that contains an unbound textfield called Total with the control source =Sum([ExpectedCost]) format = currency where cost is a field on each of the datasheet sub forms. These text fields are working fine and calculating the sum propably. Then on my main form I have an unbound text field called TotalCost which is meant to add these fields together and display the result but it doesnt work it displays £0.00.

The code I have used is on the on current event as an event procedure and it is:

Me!TotalCost = Forms!TotalStockValue!AssStock!Total + Forms!TotalStockValue!ProStock!Total + Forms!TotalStockValue!MatStock!Total + Forms!TotalStockValue!ExtStock!Total
Me.Repaint

I have tried putting this in the before update event and on load event but it always displays £0.00.

Why?

Thank you in advance, Hannah

Rich
04-26-2002, 04:56 AM
Use the control source of the text box
= Forms!TotalStockValue!AssStock!Total + Forms!TotalStockValue!ProStock!Total + Forms!TotalStockValue!MatStock!Total + Forms!TotalStockValue!ExtStock!Total