Why Access will not display data from combined queries?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MIchael Hughes

    #1

    Why Access will not display data from combined queries?

    I have a main query that pulls in information and dollar values from 4 different regions that get their data from separate queries. This, in itself, runs perfectly with all data showing. Our company has added three new regions with no data (as of now) available. I have written those queries like the others and then added what I needed to to pull in the new queries/regions. When I run the main query now, nothing shows up even though there's data in the first 4 queries. How can I show this or won't it until data is available for the new regions? I've also tried with and without the WHERE clause. My code is:
    Code:
    SELECT qryProductMaster.ReportCategory, qryProductMaster.AlphaCode, qryProductMaster.ProductID, qryProductMaster.ProductDescription, qryProductMaster.ProducType, qryProductMaster.Month, qryProductMaster.Year, IIf([qryCurrentEOMProdSalesRegion1]![Region1Qty] Is Null,0,[qryCurrentEOMProdSalesRegion1]![Region1Qty]) AS Region1Qty, IIf([qryCurrentEOMProdSalesRegion1]![Region1$] Is Null,0,[qryCurrentEOMProdSalesRegion1]![Region1$]) AS [Region1$], IIf([qryCurrentEOMProdSalesRegion2]![Region2Qty] Is Null,0,[qryCurrentEOMProdSalesRegion2]![Region2Qty]) AS Region2Qty, IIf([qryCurrentEOMProdSalesRegion2]![Region2$] Is Null,0,[qryCurrentEOMProdSalesRegion2]![Region2$]) AS [Region2$], IIf([qryCurrentEOMProdSalesRegion3]![Region3Qty] Is Null,0,[qryCurrentEOMProdSalesRegion3]![Region3Qty]) AS Region3Qty, IIf([qryCurrentEOMProdSalesRegion3]![Region3$] Is Null,0,[qryCurrentEOMProdSalesRegion3]![Region3$]) AS [Region3$], IIf([qryCurrentEOMProdSalesRegion4]![Region4Qty] Is Null,0,[qryCurrentEOMProdSalesRegion4]![Region4Qty]) AS Region4Qty, IIf([qryCurrentEOMProdSalesRegion4]![Region4$] Is Null,0,[qryCurrentEOMProdSalesRegion4]![Region4$]) AS [Region4$], IIf([qryCurrentEOMProdSalesRegion5]![Region5Qty] Is Null,0,[qryCurrentEOMProdSalesRegion5]![Region5Qty]) AS Region5Qty, IIf([qryCurrentEOMProdSalesRegion5]![Region5$] Is Null,0,[qryCurrentEOMProdSalesRegion5]![Region5$]) AS [Region5$], IIf([qryCurrentEOMProdSalesRegion6]![Region6Qty] Is Null,0,[qryCurrentEOMProdSalesRegion6]![Region6Qty]) AS Region6Qty, IIf([qryCurrentEOMProdSalesRegion6]![Region6$] Is Null,0,[qryCurrentEOMProdSalesRegion6]![Region6$]) AS [Region6$], IIf([qryCurrentEOMProdSalesRegion8]![Region8Qty] Is Null,0,[qryCurrentEOMProdSalesRegion8]![Region8Qty]) AS Region8Qty, IIf([qryCurrentEOMProdSalesRegion8]![Region8$] Is Null,0,[qryCurrentEOMProdSalesRegion8]![Region8$]) AS [Region8$], [Region1Qty]+[Region2Qty]+[Region3Qty]+[Region4Qty] AS GenexQty, [Region1$]+[Region2$]+[Region3$]+[Region4$] AS [Genex$], [qryProductMaster]![Month] & '/' & [qryProductMaster]![Year] AS MMYYYY
    FROM ((((((qryProductMaster LEFT JOIN qryCurrentEOMProdSalesRegion1 ON (qryProductMaster.ProductID = qryCurrentEOMProdSalesRegion1.ProductID) AND (qryProductMaster.Month = qryCurrentEOMProdSalesRegion1.Month) AND (qryProductMaster.Year = qryCurrentEOMProdSalesRegion1.Year)) LEFT JOIN qryCurrentEOMProdSalesRegion2 ON (qryProductMaster.ProductID = qryCurrentEOMProdSalesRegion2.ProductID) AND (qryProductMaster.Month = qryCurrentEOMProdSalesRegion2.Month) AND (qryProductMaster.Year = qryCurrentEOMProdSalesRegion2.Year)) LEFT JOIN qryCurrentEOMProdSalesRegion3 ON (qryProductMaster.ProductID = qryCurrentEOMProdSalesRegion3.ProductID) AND (qryProductMaster.Month = qryCurrentEOMProdSalesRegion3.Month) AND (qryProductMaster.Year = qryCurrentEOMProdSalesRegion3.Year)) LEFT JOIN qryCurrentEOMProdSalesRegion4 ON (qryProductMaster.ProductID = qryCurrentEOMProdSalesRegion4.ProductID) AND (qryProductMaster.Month = qryCurrentEOMProdSalesRegion4.Month) AND (qryProductMaster.Year = qryCurrentEOMProdSalesRegion4.Year)) INNER JOIN qryCurrentEOMProdSalesRegion5 ON (qryProductMaster.Month = qryCurrentEOMProdSalesRegion5.Month) AND (qryProductMaster.Year = qryCurrentEOMProdSalesRegion5.Year) AND (qryProductMaster.ProductID = qryCurrentEOMProdSalesRegion5.ProductID)) INNER JOIN qryCurrentEOMProdSalesRegion6 ON (qryProductMaster.Month = qryCurrentEOMProdSalesRegion6.Month) AND (qryProductMaster.Year = qryCurrentEOMProdSalesRegion6.Year) AND (qryProductMaster.ProductID = qryCurrentEOMProdSalesRegion6.ProductID)) INNER JOIN qryCurrentEOMProdSalesRegion8 ON (qryProductMaster.Month = qryCurrentEOMProdSalesRegion8.Month) AND (qryProductMaster.Year = qryCurrentEOMProdSalesRegion8.Year) AND (qryProductMaster.ProductID = qryCurrentEOMProdSalesRegion8.ProductID)
    WHERE (((qryCurrentEOMProdSalesRegion1.Region)="1")) OR (((qryCurrentEOMProdSalesRegion2.Region)="2")) OR (((qryCurrentEOMProdSalesRegion3.Region)="3")) OR (((qryCurrentEOMProdSalesRegion4.Region)="4")) OR (((qryCurrentEOMProdSalesRegion5.Region)="5")) OR (((qryCurrentEOMProdSalesRegion6.Region)="6")) OR (((qryCurrentEOMProdSalesRegion8.Region)="8"));
    Any help is greatly appreciated!
  • Michael Hughes
    New Member
    • Nov 2010
    • 1

    #2
    Nevermind, I found my mistake. I have both LEFT JOIN and INNER JOIN and changed where it's all LEFT JOIN.

    Comment

    Working...