Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / October 2004

Tip: Looking for answers? Try searching our database.

report subtotals incorrect

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ivan - 03 Oct 2004 20:39 GMT
I hope you can help me with a query and report in which I am getting a wrong
sub-total on Total Sales..  The report is using the following field-
=sum([Total_Sales])  in the group footer and getting the wrong answer  while
[Total_Sales] in the detail is correct .

I have an application which records multiple payments made toward a
purchase.  I am trying to generate a report based on a query and subquerys
that gives me the total payments by customer and the amount invoiced and
tehn totals per group (company).  I get the totals paid per customer and the
total invoiced (Total Sales) per customer perfectly BUT when I try to get a
total per group-  the totals are off.   The payments per entire group are
correct but the amount invoiced (i.e. Total Sales) is not correct.   I think
it is miscalculating per group based on the number of payments that each
customer made... so it is increasing the number.   In other words I think
that what is happening is if a custome rmade three payments the report is
calculating the total sales three times.

The query is below:

SELECT DISTINCTROW Customers.CompanyName, [Sales by Customer
Subquery].[Total Sales] AS [Total Sales], Sum(CLng([Sales by Customer
Subquery].[Total Sales]*[Sales by Customer
Subquery].[SalesTaxRate]*100)/100) AS [Sales Tax], Sum([Sales by Customer
Subquery].[Total Units]) AS [Total Units], [School Info].SchoolName,
Customers.ContactLastName, Customers.ContactFirstName,
Payments.PaymentAmount, [Sales by Customer Subquery].OrderDate,
Payments.PaymentDate, Sum([Sales by Customer Subquery].FreightCharge) AS
[Total Freight]
FROM (([School Info] INNER JOIN (Customers INNER JOIN [Sales by Customer
Subquery] ON Customers.CustomerID = [Sales by Customer Subquery].CustomerID)
ON ([School Info].SchoolID = Customers.CompanyName) AND ([School
Info].SchoolID = Customers.CompanyName)) INNER JOIN Orders ON
Customers.CustomerID = Orders.CustomerID) LEFT JOIN Payments ON
Orders.OrderID = Payments.OrderID
WHERE ((([Sales by Customer Subquery].OrderDate) Between #1/1/2003# And
#1/1/2004#))
GROUP BY Customers.CompanyName, [Sales by Customer Subquery].[Total Sales],
[School Info].SchoolName, Customers.ContactLastName,
Customers.ContactFirstName, Payments.PaymentAmount, [Sales by Customer
Subquery].OrderDate, Payments.PaymentDate
HAVING (((Payments.PaymentAmount)>0));
Duane Hookom - 04 Oct 2004 04:58 GMT
If I understand correctly, you need to remove the payments records and place
them in a subreport.

Signature

Duane Hookom
MS Access MVP

> I hope you can help me with a query and report in which I am getting a wrong
> sub-total on Total Sales..  The report is using the following field-
[quoted text clipped - 37 lines]
> Subquery].OrderDate, Payments.PaymentDate
> HAVING (((Payments.PaymentAmount)>0));
Allen Browne - 04 Oct 2004 05:04 GMT
Answered in m.p.a.queries
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.