report sorting

  • Thread starter Thread starter Rick Allison
  • Start date Start date
R

Rick Allison

How do I change the sorting and grouping for report in VBA?

I have a report that I need to sort two different ways based on different data in the query. I have set up the sorting and grouping for one way but cannot figure out how to do it for the other way, other than creating a completely separate report. UGLY.

I've looked at CreateGroupLevel method that but requires design mode for the report.

I'm guessing there is an easier way but I'm stumped. I figured someone out there has had this same kind of requirement and has solved it.

Thanks,
 
Check Allen Browne's report tips at
http://members.iinet.net.au/~allenbrowne/tips.html.

--
Duane Hookom
MS Access MVP
--

How do I change the sorting and grouping for report in VBA?

I have a report that I need to sort two different ways based on different
data in the query. I have set up the sorting and grouping for one way but
cannot figure out how to do it for the other way, other than creating a
completely separate report. UGLY.

I've looked at CreateGroupLevel method that but requires design mode for the
report.

I'm guessing there is an easier way but I'm stumped. I figured someone out
there has had this same kind of requirement and has solved it.

Thanks,
 
Duane,

Got it. directly from his site is this link
http://members.iinet.net.au/~allenbrowne/ser-33.html

Thanks.

Another question please.
Can you change the GroupHeader via code? For one sort I want a page break
each time the top grouplevel changes. For another sort I do not want a page
break. If I set the group header to yes in the "sorting and grouping"
dialog box the report page breaks each time the top grouplevel value changes
and vice versa if I set the value to no. I want to control this based on
what I am sorting.

I hope you understand.

Thanks
 
I would add a page break control at the bottom of the section and then use
code like:
Me.PageBreakControlName.Visible = ...your condition here...

--
Duane Hookom
MS Access MVP
--

Rick Allison said:
Duane,

Got it. directly from his site is this link
http://members.iinet.net.au/~allenbrowne/ser-33.html

Thanks.

Another question please.
Can you change the GroupHeader via code? For one sort I want a page break
each time the top grouplevel changes. For another sort I do not want a page
break. If I set the group header to yes in the "sorting and grouping"
dialog box the report page breaks each time the top grouplevel value changes
and vice versa if I set the value to no. I want to control this based on
what I am sorting.

I hope you understand.

Thanks
 
Rick said:
Can you change the GroupHeader via code? For one sort I want a page break
each time the top grouplevel changes. For another sort I do not want a page
break. If I set the group header to yes in the "sorting and grouping"
dialog box the report page breaks each time the top grouplevel value changes
and vice versa if I set the value to no. I want to control this based on
what I am sorting.


Try setting the section's ForceNewPage property to 0 for no
page break and 1 for a new page.
 
Back
Top