Detail sort in report using code

  • Thread starter Thread starter Gordon
  • Start date Start date
G

Gordon

I have a form in which I set a number of parameters for a report which
is then launched from a form button. The code for the report is
constructed on the flyin the on open event of the report.

The report has only one group level which I have set in design view.
In the on open code I have:

Me.GroupLevel(0).ControlSource = "fldYear"
Me.GroupLevel(0).SortOrder = False

......in order to sort the group by Year in ascending order. How do
I set the sort order within that? I want to sort using the field in
the detail section (fldTitle) - in alpahbetical order.

Thanks for any help

Gordon
 
There is code for setting the grouping control sources athttp://www.allenbrowne.com/ser-33.html.

--
Duane Hookom
Microsoft Access MVP










- Show quoted text -

Thanks. I was aware of that link having searched the ng prior to
posting but I couldn't understand how it applied to my case because I
only had 1 group. What I now realise is that in order to sort the
second layer (detail) level, you have to create a group for the
desired sort order field in report design view, even if you don't
intend to use it - you just set its height to zero. Then you can use
the code found at the link.

Thanks for responding.

Gordon
 
Back
Top