Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report not sorting to default sort order of query? 1

Status
Not open for further replies.

ordendelfai

Technical User
Nov 8, 2002
187
US
Access 97

I have a strange one, not sure if I should post it in the VBA forums, but I'll try here first.

I have an advanced reporting system that uses code on forms to dynamically create the SQL, then a query.

This dynamically created query is filtered and sorted with dynamically created WHERE statements based on the users selections. Basically the data in the query is exactly as it needs to be so that the report doesn't need to do anything except Open.

When the report opens, it was in the same sort order as the query the report is linked to. However, when I added SUM functions to the Report Footer, it stops using the query's sort order, and seems to have some random sort order.

If I deleted the Sum functions, the report sorts again as normal (the same sort as the query).

Any ideas what would cause a Report to NOT sort based on the underlying query when the report has no sort specified in either VBA code or in the Design?

Thanks

Joel

 
If searching thru this forum, you'll find several recomandations on not relying on the queries sort order (order by clause), but in stead use the sorting and grouping in the report.

Here's a link from Allen Browne on Sorting Records in a Report.

I haven't tried this in 97, but believe it should work there too (use the reference in the link on the Microsoft KB article where there should be information relating to 97 too)

Roy-Vidar
 
Roy, sorry for late response (I wasn't able to get to this till today).

I used the GroupLevel function in VBA to sort correctly, wasn't much extra work. Thanks for the link!

~Joel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top