Auto Update

N

Nanette

I'm wondering what is the best option.

I have several subforms on a form and I'll be using the "after update" or
"on dirty" or "on current" options in the Macros to set updates of data from
one table to another. There will actually be updates from two tables to two
other tables.

Is it more efficient to apply a macro to each field so that if someone
doesn't enter data in one field, both fields are updated.
OR
Is it better to set the macro on leaving the form? I'd have to put several
macros together I guess?
OR
Any other great ideas?
 
A

Allen Browne

In general, you don't want to store the values from a secondary table back
into the primary one.

In the Northwind sample database, for example there's a table for the
customer's Orders, and another table for the line items on the orders (since
one order can have many line items.) But you do not store the order total
back into the Orders table. If you want to see how it works, Northwind.mdb
installs with Access by default, so you can open it and check it out.

If there are valid reasons for storing a value in the parent table (e.g. if
there are times when you *want* the value to be different from the
aggregated values of the related records), use the AfterUpdate event of the
subform. You do not need to use On Current (since the value does not need to
change just because you visit a record), nor the Dirty event (since it
doesn't need changing until the change is saved, so you don't have to worry
about whether the update was cancelled.)
 
Top