I am using the following query:
SELECT tblTxn.Currency, tblTxn.Amount, tblTxn.Desc, tblAccounts.Account, tblTxn.Type
FROM tblAccounts
INNER JOIN tblTxn ON (tblAccounts.Currency = tblTxn.Currency)
WHERE
tblTxn.Type=tblAccounts.Type OR
(tblAccounts.Type Is Null And tblAccounts.Type Is Null);
Here tblTxn.Typeand tblAccounts.Typecan have values or zero values.
I need both. Zero values indicate the expected result, but the values are not.
How to fix it?
I used the query in MS Access 2007. From the solutions below, I adjusted the query as follows:
SELECT tblTxn.Currency, tblTxn.Amount, tblTxn.Desc, tblAccounts.Account, tblTxn.Type FROM tblAccounts INNER JOIN tblTxn ON tblAccounts.Currency = tblTxn.Currency WHERE Nz(tblTxn.Type,0) = Nz(tblAccounts.Type,0)
Shows the expected result. Thanks for the great support. NB. (The Nz function (value, [ValueIfNull]) is an alternative to COALESCE in Access.)
, , WHERE tblTxn.Type=tblAccounts.Type OR Nz(tblTxn.Type,0) = Nz(tblAccounts.Type,0), . , ?