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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subforms & Totals

Status
Not open for further replies.

Sensibilium

Programmer
Apr 6, 2000
310
GB
I have a Purchase Order form which has a subform for Purchase Order Details. I can pass the Totals from the subform to the parent form, but for some reason I can't update those totals in the underlying Purchase Order table, as when a calculated control is updated it doesn't seem to trigger any events in the form or in the control itself!<br><br>I've tried changing to an Unbound form and updating to the tables afterward, but due to the PUOrderID being an autonumber, I can't use it as a reference to the Purchase Order Details subform without first updating the Purchase Order Table!<br><br>It would be preferable if I could do it as below (a BeforeUpdate on the control doesn't work!):<br><br>Sub CalculatedControl_BeforeUpdate()<br>UnderlyingTable!TotalValue = CalculatedControl.Value<br>End Sub<br><br>Anybody help? I hate order forms! Thank you.
 
Why do you want to backfill the table with the total value of an order? You can get that information in a query very easily and then base a report on the query. Or just create a nice report with some calc fields to show the totals.<br><br>Try this. Make a Totals query and add both tables into it.&nbsp;&nbsp;Add all the fields from the Purchase Orders Table and just the order total field from the Details table. Set the Totals row to Sum for the order total field and set all the other fields to Group By.<br><br>We can go from there if that is not what you want. You can treat that query just like you would the table.<br><br>
 
Thank for that, I came to same conclusion after installing the Northwind DB to see how they did it.<br><br>A problem with these 'Totals' queries is that they make the recordset not updateable, but I've worked my way around it now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top