I’ve developed a quick and dirty MS Access 2010 .accdb database for me to store my store receipts.
I have two main tables and I have set up a one-to-many relationship between Receipts and Items.
Receipts ( ReceiptId, DateTime, GrandTotal )
Items ( ItemId, ReceiptId, Description, LineTotal )
I’d like to add a Computed Column to the Receipts table that is the SUM() of all of that receipt’s Items.LineTotal, which will allow me to detect discrepancies between a receipt’s stated total and the amount I actually paid (such as tips on pizza deliveries).
When I open the table designer for Receipts and add a Calculated Column I don’t see the Items table listed in the Expression Builder. I’ve made a screenshot:
.
The calculated field can not reference fields in a different table. See Add a calculated field to a table:
In Access 2010, you can create table fields that calculate values. The calculations can include values from fields in the same table as well as built-in Access functions.
NOTES
– The calculation cannot include fields from other tables or queries.
Consider whether a query to supply the calculated field would be an acceptable alternative. Or, with a form or report, you could add a control and use its control source property to perform the calculation.