views:

35

answers:

2

I created a report in Access 2007. How could I view and change the SQL that the report is based on? For example, I am trying to find out how to change the way the report is sorted. I would expect this is based on the original sql query generated when I ran through the report wizard. Is this stored in some property sheet? How can I view it in the actual report "object" code.

+1  A: 

From the report's design view, view the report's properties (I right-click on the box in the upper left corner under the widow's title bar.)

Then you can modify the report's recordSource property.

You'll also want to look at the way the report is grouped and sorted. I'm pretty sure it's under the View menu, but they've uninstalled 2007 as of yesterday out here, so I'm still finding where stuff is in 2010.

HTH

Beth
Ah k, I will check that out. Still thinking if I want to mess around with 2010...
MattUebel
Sort order in the Recordsource is overridden by the SORTING AND GROUPING, and even without the latter, it's ignored.
David-W-Fenton
+2  A: 

There is no point in sorting in the SQL or query on which the report is based. The report uses its own sorting and grouping which you will find on the ribbon (Access 2010) in design view for the report: Group & Sort.

The record source can be found on the property sheet for the report.

Remou
Let me emphasize @Remou's point: the report layout's SORTING AND GROUPING settings will override any sort order in the report's Recordsource. And even without any SORTING AND GROUPING levels defined, it's unreliable to depend on the sort order in the Recordsource (that semms illogical to me, but experience has taught me it's true).
David-W-Fenton
Yes I can see how that works now. Thanks. Do you know if this how the gui settings translate into the code?
MattUebel
Remou