Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Filter a report based on a sum per group

Posted on 2008-06-19
6
Medium Priority
?
563 Views
Last Modified: 2011-10-19
I've built a report where one of the fields is a sum for each group. I'd like to be able to filter out all the groups where Sum(field)>0 for each group.  I feel like this should be easy, but I'm not totally sure how to do this one.  Thanks in advance!
0
Comment
Question by:steam23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:bandriese
ID: 21825537
Sometimes I have trouble doing this sort of thing my self. What I would suggest is create a query to generate this information. Create a second query, if required, to filter out all the records with zero values, then base your report on the second query. You should be able to just change the Row source in the report without redesigning your report. Your grouped data in the report will then have no groups with zeros.
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 21825688
Please post the query you are using for this report.
0
 

Author Comment

by:steam23
ID: 21825890
Here's my query:

SELECT Students.[Student Name], Students.[Parent Name], Students.[Home Phone], Students.[Business Phone], Students.[Mobile Phone], Schedule.[Formatted time], Schedule.Categories, Schedule.Makeup, Schedule.[Start Time], Students.[Current Status]
FROM Schedule RIGHT JOIN Students ON Schedule.[Student Name] = Students.[Student Name]
WHERE (((Schedule.Categories) Like "*xld*" Or (Schedule.Categories) Like "*Admin mixup*" Or (Schedule.Categories) Like "*NSN*" Or (Schedule.Categories) Like "*mu*" Or (Schedule.Categories) Like "*sick*" Or (Schedule.Categories) Like "*credited*") AND ((Students.[Current Status])="Active"));

In my detail header I have a text box with the value of sum(schedule.makeup) and that's the value i want to filter on.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:steam23
ID: 21826379
bandriese: I'm not sure how to do what you're talking about. How do you make a second querry for this case that will filter out those with a 0 sum?
0
 
LVL 3

Accepted Solution

by:
bandriese earned 500 total points
ID: 21826877
If you create a query, say QueryA that says:

SELECT * from MyTable WHERE MyField > "0"

Then Create another query that says:

SELECT * from QueryA WHERE MyOtherField = "something"

Now you don't need 2 queries to accomplish what I did above, but if you haven't done this before, it should be noted that you can build queries and have joins (relationships) on queries and well as tables. There are situations in Access where you have to create multiple queries to accomplish one task, for example in some situations using multiple tables with both left and right joins (ambiguous outer joins it's called).

For your query above, why not create two sets of queries. One to do the filtering and one to pull up the records you want to see with a relationship between them. I think in your case it's difficult to filter using just the query above because you're grouping by something on your report and want the sub of schedule.makeup to < or > than whatever is on the form, not schedule.makeup itself.

See the query, "ShowTheRecords" in the attached database. Here I'm showing all orders for any customer where the sum of the PO numbers for all Orders a customer has is greater than 4. Carefull with "FiltertheSum" in design view. Access wants to make the >4 a >"4" which will cause an error, you either need a 3rd query or just remove the quotes in SQL view before you run it.
Sample.mdb
0
 

Author Closing Comment

by:steam23
ID: 31468940
Thanks! That did it. I really appreciate the sample file. It helped alot!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question