Display sum from query on Form

flemmo

Registered User.
Local time
Today, 00:30
Joined
Apr 26, 2006
Messages
69
I have the following query that pull in all stock order details:

Code:
SELECT StockOrder.OrderDate, StockOrder.OrderDiscount, StockOrder.Carriage, StockOrderDetails.Quantity, StockOrderDetails.UnitPrice, StockOrderDetails.StockOrderDetailsID
FROM StockOrder INNER JOIN StockOrderDetails ON StockOrder.StockOrderID = StockOrderDetails.StockOrderID;

If I create a form with the source of the above query I can use a textbox to calculate the total orders using this

Code:
=Sum(CCur(Nz([UnitPrice])*Nz([[Quantity])*(1-Nz([OrderDiscount]))/100)*100)

Up to now I've been inserting the form as a subform to pass the total to the parent form where I want the info to be displayed. The problem with this is there is a lag between the subform updating the value and displaying it on the parent form.

Is there I way that I can set the parent form to have a textbox showing the sum of the query? I've tried adding the query name as follows but it comes back with #Error

Code:
=Sum(CCur(Nz([TotalExp_SO]![UnitPrice])*Nz([TotalExp_SO]![Quantity])*(1-Nz([TotalExp_SO]![OrderDiscount]))/100)*100)

Thanks in advance
 
The Nz() function requires two parameters.
Code:
Nz([I]expression, valueIfNull[/I])
 

Users who are viewing this thread

Back
Top Bottom