Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have been messing around in MS Access for quite a while trying to get a report just the way I want it but have been unsuccessful. Help please! I have 13 customer types, many businesses within those types, and a lot of sales to each of those businesses that I would like to sum. Here's where the date regulation comes in, I want the user to be able to input the dates he/she wants. I believe I have done this by adding my DateShip field to the query, not showing, with the criteria: Between [Begin Date] AND [End Date]
After the sales are summed and ranked, I also just would like the top ten for each customer type.
I have tried following the example on http://support.microsoft.com/kb/208822 but my tables are not set up that way. I have three tables, Customers, Invoice Detail, and Invoice, with the fields CustID, CustType,BusinessName; InvNo, UnitCost, QtyShipped; and CustID, InvNo; respectively. I also have a query with all these fields, but would this not be wise to base this type of query/report of another query?
Here is the query I have now:
SELECT TOP 10 Customers.CustType, Customers.BusinessName, Sum([Invoice Detail]![UnitCost]*[QtyShipped]) AS Sales
FROM (Customers INNER JOIN Invoices ON Customers.CustID = Invoices.CustID) INNER JOIN [Invoice Detail] ON (Invoices.InvNo = [Invoice Detail].InvNo) AND (Invoices.InvNo = [Invoice Detail].InvNo)
GROUP BY Customers.CustType, Customers.BusinessName, Invoices.InvNo, Invoices.DateShip
HAVING (((Customers.CustType)=[Report]![TopBusinessByCustType]![CustType])
AND ((Invoices.DateShip) Between [Begin Date] And [End Date]))
ORDER BY Sum([Invoice Detail]![UnitCost]*[QtyShipped]) DESC;The report it's viewing has the customer type listed twice next to itself- was trying to follow the method of the link above. Problems with this is it's not summing all the sales for the dates given. Rather, it's listing Company A with sales 1,2,3, and 4.
Am I headed in the right direction, or way off? Any ideas or suggestions please? I'm realatively new to Access but picking it up pretty quickly. Thank you so much in advance for any help!

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |