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

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.
 
A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top