Converting Null values generated by a query

Dave888

Registered User.
Local time
Today, 01:44
Joined
Dec 3, 2008
Messages
24
If a query finds a null value is It possible to write an expression that will change it to a default value like zero? As you can see from my query results VPO 333333 has a null for 'SumOfVPOAmount'. This is because I payment has not yet been made against that VPO. The purpose of this database is to track payments against various VPOs.
I should also explain that this is a sub query I'm running from two different queries, not tables, so it's not as easy as an update function... or atleast I don't think it is... but I could be wrong.
query%20results.jpg


This is the query I'm using:
SELECT VPO.VPONumber, VPO.VendorCode, [2VPOTotalByVPO].SumOfTotalCost, Sum([3PaymentTotalsByVPO].VPOAmountPaid) AS SumOfVPOAmountPaid
FROM 3PaymentTotalsByVPO RIGHT JOIN (2VPOTotalByVPO INNER JOIN VPO ON [2VPOTotalByVPO].VPONumber = VPO.VPONumber) ON [3PaymentTotalsByVPO].VPO_VPONumber = VPO.VPONumber
GROUP BY VPO.VPONumber, VPO.VendorCode, [2VPOTotalByVPO].SumOfTotalCost;
 
Last edited:
yes, Nz worked. Thanks!

Here is the expression I wrote:
SELECT VPO.VPONumber, VPO.VendorCode, [2VPOTotalByVPO].SumOfTotalCost, Sum(nz([3PaymentTotalsByVPO].VPOAmountPaid)) AS SumOfTotalPayments, [sumoftotalcost]-Sum(nz([3PaymentTotalsByVPO].VPOAmountPaid)) AS BalanceOwing
FROM 3PaymentTotalsByVPO RIGHT JOIN (2VPOTotalByVPO INNER JOIN VPO ON [2VPOTotalByVPO].VPONumber = VPO.VPONumber) ON [3PaymentTotalsByVPO].VPO_VPONumber = VPO.VPONumber
GROUP BY VPO.VPONumber, VPO.VendorCode, [2VPOTotalByVPO].SumOfTotalCost;
 

Users who are viewing this thread

Back
Top Bottom