View Full Version : Sorting records based on the results of functions with a report


mtairhead
01-03-2006, 10:19 AM
I'm not sure where to begin, and I have no idea what sort of search terms I would use for this:

If I have a report grouped by a text field, and the group footer counts the number of records in that group, is there any way to sort the records within that group by number of occurances? Basically, the group that has the most records in it needs to be first. The group that has the least needs to be last.

Thanks for any help...

Andrew

Matt Greatorex
01-03-2006, 11:51 AM
Is there a query underlying the report?

If so, unless I'm missing something (and it wouldn't be the first time) add:
1) a grouping clause (whatever the category is that you want to count by) 2) a count of all records within that group.

e.g. if the query were currently returning two fields - say, Animal Species and Gender - change it to also group by Animal Species, then add Count(*).

You could then order the results by the Count(*) field, in descending order.

mtairhead
01-03-2006, 12:58 PM
You likely aren't far off - I just have never done it.

You're saything that I add a grouping clause in my query? There is a query behind the report....I just haven't ever grouped via query before. Is this something that I must do via SQL, or can I use the regular query design view?

...Help's keywords for "Grouping Clause" hasn't gotten me far...

un-access-schooled,

Andrew

mtairhead
01-03-2006, 01:51 PM
erp - never mind. Figured it out!

Thanks!

Andrew

Matt Greatorex
01-03-2006, 01:53 PM
As long as it's working, you're welcome.