Adding two queries when one is null

M

MissPathan

SELECT
IIf(IsNull(Sum([vend_div_vol]![vendvolume])),Sum([OPDS2_Div_Vol]![DivVolume]),IIf(IsNull(Sum([OPDS2_Div_Vol]![DivVolume])),Sum([vend_div_vol]![vendvolume]),Sum([vend_div_vol]![vendvolume])+Sum([OPDS2_Div_Vol]![DivVolume]))) AS Volume
FROM ((OPDS2_Div_Vol INNER JOIN Terminals_Chosen ON OPDS2_Div_Vol.Terminal =
Terminals_Chosen.Terminal_ID) INNER JOIN Months_Chosen ON OPDS2_Div_Vol.Month
= Months_Chosen.Month) INNER JOIN vend_div_vol ON
(Terminals_Chosen.Terminal_ID = vend_div_vol.SAPID) AND (Months_Chosen.Month
= vend_div_vol.MONTH);

How can I make this work? I'm still getting nothing when I run the query.
 
J

JLamb

If you expect null values in one of the queries you need to outer join not
inner join. Inner join will only produce results when the join value appears
in both tables or queries.
 
Top