Sorting and Grouping

  • Thread starter Thread starter Bryan
  • Start date Start date
B

Bryan

Please help. I have a report that uses three groups, and wish to change the
order of those groups when opening the form. I am able to do that with the
..ControlSource property, but I'm not getting the result I expect. e.g., I
remove the original group(0), and slide (1) and (2) up into groups (0) and
(1), respectively. The sort order changes, but I see the group(0) header
for each detail under it, instead of all details under one instance of the
header. When I change the .ControlSources back to their original everything
looks as expected.

Can someone help demystify this for me?

Thanks,
Bryan
 
Bryan

Are you using the report design window? Are you using the toolbar button
for the sorting/grouping?

What do you mean when you say "opening the form"?

More info, please...

Jeff Boyce
<Access MVP>
 
Jeff,

I'm using VBA code in the report's OnOpen event.
Me.GroupLevel(0).ControlSource = strString

Bryan
 
Bryan

An alternate approach would be to re-design the report. If you open a copy
of the report in design mode, you can use the Toolbar button for
Sorting/Grouping to create the two groups you want, then use the list of
fields to insert the fields you want.

Or is there a business need you haven't mentioned that requires you to
create the groupings "on the fly", OnOpen?

Good luck

Jeff Boyce
<Access MVP>
 
Jeff,

The "business need" I have is different users who want different things.
Leave it to them to cause problems! ;)

The way it is now, I've got the report saved with group(0) being critical
issues, group(1) as the client, and group(2) is the detail value sorted.
Some users have complained about the critical issues being on top because
non-critical issues under the same client are then appearing in separate
pages on the report. I've added a sort order option on the report setup
form to allow users to sort by client, ignoring the type of issue. And
that's where I'm hitting the problem. When sorting in run time, the details
are no longer grouped under 1 client header. For example:

Report saved with group(0)=critical and group(1)=client:

ClientName1
Critical Flag -- Detail infoA
Critical Flag -- Detail infoD
Client Name2
Critical Flag -- Detail infoA
Critical Flag -- Detail infoB
ClientName1
Non-critical -- Detail infoB
Non-critical -- Detail infoC

After changing it on the fly to be group(0)=client, I get:

ClientName1
Critical Flag -- Detail infoA
ClientName1
Non-critical -- Detail infoB
ClientName1
Non-critical -- Detail infoC
ClientName1
Critical Flag -- Detail infoD

What I want is:
ClientName1
Critical Flag -- Detail infoA
Non-critical -- Detail infoB
Non-critical -- Detail infoC
Critical Flag -- Detail infoD

If I use the sorting and grouping box in design view and swap group(0) with
group(1), I get the results I'm looking for, i.e., the third example. But
I'm not going to give the users access to the design (not to mention they
get an MDE database).

Does this explain it better? I'm having a hard time understanding it enough
to make my point clear.

Thanks for your help,
Bryan
 
Back
Top