data entry + sum into database

G

Guest

hi!

I created a form with the following details for the user to key in.

data1 data2 sum_of_data1_and_data2
data3 data4 sum_of_data3_and_data4
sum of the above

What i'm trying to do here is, user will key in value for
data1,data2,data3,data4.
The sum of data1 and data2, sum of data3 and data4, and sum of the above wil
be calculated automatically. I know how to create the form and database for
user to key in data1,2,3,4 once they click the save button, but i don;t know
how to save the auto calculated sum value into database(i only know how to
display the calculated sum on screen but it's not save into database). Pls
help on this by showing me some sample or simple coding to save the sum
values into database. Thks!
 
R

Rick B

You don't. That would be redundant to store the calculated value when you
can simply calculate it when you ened it.

What if the user makes a tpo and goes back to fix data1? How will the
database update the sum_of_data1_and_data2?

Proper database design would prevent the storing of calculated values. When
you need to display your total in a form, report, or query, simply calculate
it.

If you search, you will find this same answer posted all through these
newsgroups. You may want to search for your answers before posting new
threads.

Rick B
 
L

Larry Daugherty

Hi David,

It can be easily done but you should not do it. It is against the rules of
normalization to store information in the record that's the result of any
part of the record. Always re-calculate it when you need to see it.

HTH
 

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