query expression troubles

Sym

Registered User.
Local time
Today, 08:08
Joined
Feb 21, 2015
Messages
40
Im am new to access and querys so im probably doing something simple wrong but here is my problem

I have a query that sums up the amount of products that are allocated by customer Orders and another that sums up the Products that are allocated by pending Transfers to our trucks, so what im trying to do is add the 2 fields up from both queries in another query so I can have a total amount of products that are allocated. I can get the values of the two queries to show up properly in the query using "itemNumber" and "ProductName" from my "products" table and the summed value from the two queries but I cant get them to add together by using an addition expression to add the two value fields here is the SQL

SELECT Products.ItemNumber, Products.ProductName, qryAllocatedbyCustomerOrder.[Quantity Allocated by CO], qryAllocatedbyTransfer.[Quantity Allocated by Transfer], [Quantity Allocated by CO]+[Quantity Allocated by Transfer] AS Expr1
FROM (Products LEFT JOIN qryAllocatedbyCustomerOrder ON Products.ItemNumber = qryAllocatedbyCustomerOrder.ItemNumber) LEFT JOIN qryAllocatedbyTransfer ON Products.ItemNumber = qryAllocatedbyTransfer.ItemNumber;

any ideas why its not adding up?
 
Does this work?

Nz([Quantity Allocated by CO], 0)+Nz([Quantity Allocated by Transfer], 0) AS Expr1
 
Does this work?

Nz([Quantity Allocated by CO], 0)+Nz([Quantity Allocated by Transfer], 0) AS Expr1

yes it does, thank you :)

now if you wouldnt mind could you briefly explain what the Nz bit means and why I need it? im glad that this works and will definetly use it but if im going to use it I would like to know what it means, for future use.

I tried to google it but I know absolutely nothing when it comes to vba so it got over my head quickly.

Thank you, much appreciated :)
 

Users who are viewing this thread

Back
Top Bottom