Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation in default value property of table field? 1

Status
Not open for further replies.

MaddiMond

Technical User
Mar 28, 2005
76
US
I built a table where I put a column called ComEarned. But, since I ended up doing all the calculations in a report, this column stays empty. My employers now want that this column get's populated with data. I tried to put a calculation in the property sheet of the field in the table, but it did not accept a calcualtion. How can I populate this field through a calculation involving other fields from the same table?

Greetings,

Maddi
 
This is often a bad idea to store derived/calculated value in a database.
The usual way is to retrieve the data with a query doing all the calculations and so the result is always accurate.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
It's usually not a good idea to store computed values but you can run an SQL UPDATE query to fill in the values. Access doesn't support Triggers so there isn't really any way to automatically fill in the computed value when you add or modify fields in the table.

The other recommended alternative is to write a query that displays the other fields in the table and adds the "ComEarned" field as a computed field. That way you can be assured that it's always correct and complete for every record in the table.
 
I tried that, but Access told me that it had problem with having the source of the calculation and the result come from and go to the same table. What am I doing wrong?

Maddi
 
What am I doing wrong?
What have you tried ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top