Hi all - this is my first post here 
I need to calculate a field based upon two other fields, but not quite sure how to do this.
The situation is I have a form based on a table called SalesOrders, and a table called PurchaseContracts.
I need to work out a field called Offtake in the PurchaseContracts.
Basically every time a new order is enterd in SalesOrders, it has a ProductCode which is selected from a list pulled from the PurchaseContract table then I enter the amount for OrderInTonnes.
What I need to do is have the Offtake field provide a total of all the OrderInTonnes based on the ProductCode.
So each ProductCode could have any amount of orders in the SalesOrders, and I need the Offtake to add up all the OrderInTonnes for each ProductCode.
To sum up, if the ProductCode from SalesOrders matches the ProductCode from PurchaseContracts, the OrderInTonnes from SalesOrders would be added up and the total going into the Offtake field.
I'm imagining that I could use the IIF function?
I know that it's not usual practice to store calculated values, but the person I'm doing this for wants it like that!
Cheers, Paul

I need to calculate a field based upon two other fields, but not quite sure how to do this.
The situation is I have a form based on a table called SalesOrders, and a table called PurchaseContracts.
I need to work out a field called Offtake in the PurchaseContracts.
Basically every time a new order is enterd in SalesOrders, it has a ProductCode which is selected from a list pulled from the PurchaseContract table then I enter the amount for OrderInTonnes.
What I need to do is have the Offtake field provide a total of all the OrderInTonnes based on the ProductCode.
So each ProductCode could have any amount of orders in the SalesOrders, and I need the Offtake to add up all the OrderInTonnes for each ProductCode.
To sum up, if the ProductCode from SalesOrders matches the ProductCode from PurchaseContracts, the OrderInTonnes from SalesOrders would be added up and the total going into the Offtake field.
I'm imagining that I could use the IIF function?
I know that it's not usual practice to store calculated values, but the person I'm doing this for wants it like that!
Cheers, Paul