Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Slow Sum on Subform 1

Status
Not open for further replies.

Costefran

Technical User
Jan 2, 2008
197
GB
Can Anyone help

I have the following arrangement on a form / subform which I am having problems with

Subform Detail
[Quantity] *[Unit Cost]=[Total Line Cost]
Subform Footer
[Sum of Total Line Cost]=Sum([Total Line Cost])

Main Form
[Total Cost] = [Subform].[Sum Of Total Line Cost]


My problem is as follows
When I fill in [Quantity] and [Unit cost], [Total Line Cost] works fine but [Sum of Total Line Cost] only seems to calculate if I click in the subform again.
I would like to jump into the main form without having to click again in the subform but when I do this I get the wrong figure in the main form
Is the any way I can recalculate the subform footer sum on an after update event on [Quantity] and [Unit Cost]. I have tried requery but this doesn't seem to work

Thanks
 
How are ya Costefran . . .

In the [purple]AfterUpdate[/purple] event of [blue][Quantity][/blue] & [blue][Unit Cost][/blue], try:
Code:
[blue]Me.ReCalc[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Aceman

Have tried this and still have the same problem

The control that sums the total line cost still reuires an extra click on the subform before calculating the final sum

Is there anyway I can force a mouse button click on ther form by using code before I move focus to the main form?

Thanks

 
Set the ControlSource property of [Sum of Total Line Cost] to:
=Sum([Quantity]*[Unit Cost])

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top