Using calculated value in subform as field entry in main form

  • Thread starter Thread starter Guest
  • Start date Start date
Firstly, a good design does not store a calculated result in another table.
One of the fundamental rules of data normalization is: Do not store
dependent values.

If you want to do it anyway, use the AfterUpdate event of the Form in the
subform (i.e. Form_AfterUpdate, not the AfterUpdate of some control) to
assign the value to the control on the parent form. You might need to use
the Recalc method of the subform first to ensure the calculation is up to
date before you assign it.

For an example of how to display the value on the main form without storing
it, open the Northwind sample database, the Orders form, and see how the
Subtotal refers to a calculated control in the subform.
 
Back
Top