Results 1 to 4 of 4
  1. #1
    BLD21 is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Apr 2011
    Posts
    55

    Sorting within a group

    2007, I have a report which is using a simple select query for the control source. In the report I am using 3 text boxes with expressions in the control source. One is for getting a total count the other is for a total reject count. The last one is used to calcuate the percentage.(reject count/total count).



    I am grouping on company name. I want to be able to SORT by the Percentage field within the grouping. Is this possible?

    Thanks to all who reply!!

    Bruce D.

  2. #2
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    I would personally do the calculations in the source query, but you should be able to use the 'expression' option in the group/sort/total area. You will sort on your formula....not on the calculated text boxes in your report....hope that makes sense.

  3. #3
    BLD21 is offline Advanced Beginner
    Windows 2K Access 2007
    Join Date
    Apr 2011
    Posts
    55
    I agree with using the source query, but I could not get the counting done correctly in the query. I would need a grouping by for each Company, then a record count of all the Codes, and a record count for just the Rejects. I would then have to create an expression for something like TOTAL REJECTS/TOTAL FED for the percentage.


    What I am using in the report is a grouping by Company, then I have one text box with =Count([tbl_Rejects]![COMPANY_NAME]) and the other text box with =Count(IIf([SORT_DECISION_CODE]="REJECT",1,Null)). For the percentage I am using the NAME for =[Total Rejects]/[Total Fed]. This works in calcuating the percents but I can't get it right for the sorting from highest to lowest.

    Any help greatly appreciated!!

  4. #4
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    In the group/sort expression have you tried:
    =Count(IIf([SORT_DECISION_CODE]="REJECT",1,Null))/Count([tbl_Rejects]![COMPANY_NAME])

    You can also use IIf([SORT_DECISION_CODE]="REJECT",1,Null)) in an aggragate query....just set the group option to count.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 11-29-2010, 08:16 AM
  2. Sorting records
    By Samu77 in forum Access
    Replies: 1
    Last Post: 09-13-2010, 10:40 PM
  3. Date Sorting
    By sfoot0309 in forum Queries
    Replies: 1
    Last Post: 04-25-2010, 09:59 PM
  4. Need Sorting Help
    By rbpd5015 in forum Access
    Replies: 1
    Last Post: 09-28-2009, 07:39 PM
  5. columns for group detail but not group header?
    By Coolpapabell in forum Reports
    Replies: 0
    Last Post: 08-21-2009, 08:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums