Update a field in a table with a calculation

Oscar

Registered User.
Local time
Today, 22:28
Joined
Dec 9, 2002
Messages
23
I have a column in a table which I would like to update by using a calculation involving other columns in the same table. For example ColumnA * ColumnB updates ColumnC. I have got the calculation I want to use by building it in a query and it works. However, I don't know how to make it update the column I want the result to go into. I have tried to put the calculation in the update criteria for the column, but it doesn't work. Am I on the right track or totally wrong?
 
Unless I have misunderstood you, there is no need for ColumnC.

This sort of calculated field shoud not be stored in a table, but calculated in queries / reports / forms etc when needed.

Do not store data that can be uniformally calculated.

If you really think you need to store it (which sounds very unlikely), an update query can be utilised to "update" information in a table based on calculations etc.

Brad.
 
Brads right, you should not store the calcuation in another field. However, if you really must store the result, add code to the after update event of the second field

Me!Col3 = Me!Col1 * Me!Col2


David
 
Thanks for putting me back on track, wasn't thinking. Sometimes things can be so obvious but you just don't see it.
 

Users who are viewing this thread

Back
Top Bottom