Order by / Sort Report based on data in Subreport

Ally

Registered User.
Local time
Today, 09:11
Joined
Sep 18, 2001
Messages
617
I have a report with a subreport but want the report sorted in descending order of the data in the subreport. I've tried all sorts of combinations of OrderBy, but no joy.

Does anyone know if this is possible please?
 
The report's sorting and grouping options control the sort sequence of a report NOT the order by clause of the query. If the field that you want to sort on is NOT in the report's recordsource, there is NO way to sort on it.

If you want the report sorted by some column in the subreport's recordsource, you're going to have to invert the relationship. Make the subreport the main report and make the main report the subreport.
 
Thank you. It took some jigging around, but it works great now.
 
Subreport Sort Order

Hi

Access 2002
WinXPPro

Please tell me this is not true?? Is it really NOT possible to sort a Subreport into a desired order?

I have a Main report with a Subreport. The Main report is bound to QueryA. This query reads records from TableA which has an Invoice_ID (autonumber) field.

The Subreport is bound to another Query, QueryB, which extracts records from a separate table, TableB, which also has an Invoice_Id feild. The Main report and Subreport are linked with the Invoice_Id feild as master/child lnks.

The Subreport lists out its items fine but in REVERSE order. I have spent hours checking the various table, query and report "OrderBy"s but nothing I can do will make the Subreport print it's records in the correct order. The Subreport's records HAVE to be printed in the order they were added into the table in the first place.

I think I am having a stress attack.... :) Can someone reduce my levels please?

Thanks in anticipation
 
Last edited:
Hi

My problem is solved. For those with a similar problem, I found two posts on here, one by DJKarl

http://www.access-programmers.co.uk/forums/showthread.php?t=138260&highlight=order+report

"You could just right click on the detail section (the section"bar") and select Sorting and Grouping"

And then another by John Gunn which pointed out some of the obscurities

http://www.access-programmers.co.uk/forums/showthread.php?t=32769&highlight=orderby+subreport

Thanks to Karl and John for their help
 
There is no problem with ordering a subreport. Just use the subreport's Sorting and Grouping options. The OP's problem was that he wanted the main report sorted by something contained in the subreport.
 

Users who are viewing this thread

Back
Top Bottom