[AccessD] Change Order within Access 2007 Report Group - Thanks! Plus Bonus Puzzler

Brad Marks bradm at blackforestltd.com
Wed Dec 10 15:25:54 CST 2014


Susan, Bruce, Charlotte,

Thanks for your assistance on this question.

I now have a small Access 2007 report that has two buttons.  One button changes the SortOrder in the Report Group to Ascending and the second button changes the SortOrder in the Report Group to Descending. (I use "Report View")

Here is the actual VBA code that I am using for these two report buttons. 

Me.GroupLevel(0).SortOrder = False      ' Ascending

Me.GroupLevel(0).SortOrder = True       ' Descending



This all works nicely, except for one thing.  In order to see the affect of either the Ascending button or the affect of the Descending button, I need to execute the same  line of code two times.

Example - 
  
Me.GroupLevel(0).SortOrder = False      ' Ascending
Me.GroupLevel(0).SortOrder = False      ' Ascending


Things seem to always work nicely, when I do this, but I would like to understand why it appears to take two executions of this code.

Any ideas?

Thanks,
Brad
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Tuesday, December 09, 2014 5:16 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Change Order within Access 2007 Report Group

I once added a toolbar to a report like this and used VBA to group the report according to the user choice from the toolbar. It was easy -- I thought maybe I'd written about it and looked for an online article, but didn't find one. Might be something to write about. It would be easy to add sort options to a custom group that opens with the report I would think.

Susan H.

On Tue, Dec 9, 2014 at 5:33 PM, Charlotte Foust <charlotte.foust at gmail.com>
wrote:

> The simplest way is to have two groups on the same values, one sorted 
> one way and the second sorted the other.  Then just show or hide the 
> group depending on what the user wants.
>
> Charlotte
>
> On Tue, Dec 9, 2014 at 1:48 PM, Brad Marks <bradm at blackforestltd.com>
> wrote:
>
> > All,
> >
> > Is it possible to change the order in an Access report Group from 
> > "with A on top" to "with Z on top" with VBA code?
> >
> > We currently have an Access 2007 report that our Accounting 
> > Department uses daily.  This report has one report "Group" on 
> > Sales_Order_Number (Ascending).
> >
> > Recently it was requested that a second report be created with the 
> > Sales_Order_Numbers in descending order.
> >
> > Instead of creating a second report, I would like to have a button 
> > to change the Report's Group Order on the fly.  Is this possible via 
> > VBA
> code?
> >
> > We have several other reports where the sort order is changed on the 
> > fly, but none of these have report Groups.
> >
> > Thanks,
> > Brad
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list