You'll find an example in the sample Northwind database which does this.
take a look at the code in the AfterUpdate event procedure of the ProductID
control in the Order Details subform. You'll see that it looks up the
current unit price from the Products table and assigns this to the bound
UnitPrice control in the subform. This is then used to compute the gross
price per item in a computed column in the subform's underlying query. This
is directly analogous to the situation Jeanette referred to.
To produce a total sales amount over a period would be a question of summing
the return value of the same expression used to compute the gross price, e.g.
to return the total sales for a year entered as a parameter value when
prompted:
SELECT [Enter Year:] As Year,
FORMAT(SUM((UnitPrice*Quantity*(1-Discount)/100)*100),"Currency")
AS [Total Sales]
FROM [Order Details] INNER JOIN Orders
ON Orders.OrderID = [Order Details].OrderID
WHERE YEAR(OrderDate) = [Enter Year:];
Ken Sheridan
Stafford, England