update main form based on a field in subform (datasheet view)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a main form with a field called "TotalOrdered", and a subform
(datasheet) with items called "Number Ordered", say, on the subform with
record1 "Number Ordered" = 1; record2 "number ordered" = 5; record3 "number
ordered" = 2.

Then the field "totalOrdered" in mainform should be updated to 8 (1+5+2).
i tried to put the code in the subform's "number ORdered"'s afterUpdate
event, but that event doesn't get triggered. However, the event got
triggered when I am running the subform directly.

Please help.
 
The short answer is: Don't store this total.

Read about normalization--particularly the rule about not storing dependent
data. You can very easily caculate it when needed, and even display it on
the main form if desired. There's an example of how to achieve that in the
Northwind sample database, the Orders form.
 
Back
Top