Forum Discussion

Sue_69's avatar
Sue_69
Copper Contributor
Sep 15, 2023
Solved

Northwind Traders Developer 2.2 Template Sales Reports bug

I believe there is a bug in the Monthly Orders by Product report, or more specifically in the underlying query qryrptSalesByProduct.   This report shows each product from orders in the specified time...
  • AccessAllstars's avatar
    Sep 16, 2023

    Hi Sue_69 

     

    We have a solution for the query issue you have identified in the NW2.2 Dev Edition.

     

    Please change query qryrptSalesByProduct to the following

     

    SELECT Products.ProductName, Products.ProductID, Format([OrderDate],"mmm-yyyy") AS MonthYear, Format([OrderDate],"yyyy-mm") AS MonthYearSort, Format([OrderDate],"q-yyyy") AS QuarterYear, Sum([OrderDetails].[Quantity]*(1-[OrderDetails].[Discount])*[OrderDetails].[UnitPrice]) AS SumOfOrderTotal
    FROM Products INNER JOIN (Orders INNER JOIN OrderDetails ON Orders.OrderID = OrderDetails.OrderID) ON Products.ProductID = OrderDetails.ProductID
    WHERE (((Orders.OrderDate) Between [Forms]![frmReports].[txtStartDate] And DateAdd("d",1,[Forms]![frmReports].[txtEndDate])))
    GROUP BY Products.ProductName, Products.ProductID, Format([OrderDate],"mmm-yyyy"), Format([OrderDate],"yyyy-mm"), Format([OrderDate],"q-yyyy");

     

    We would also like to suggest you change the caption on rptSalesByProductQuarterly to Quarterly Orders By Product - the current caption is the same as the rptSalesByProduct.  If both are open at the same time it will be confusing.

     

    Great find!  Thank you for your feedback. 

    -Kim-