[AccessD] Change Order within Access 2007 Report Group - Need to Execute Command Two Times to See Results

Brad Marks bradm at blackforestltd.com
Thu Dec 11 15:33:21 CST 2014


Charlotte,

Thanks for the help.

I tried adding the "me.requery" command but this change did not make a difference.

If "Me.GroupLevel(0).SortOrder = False" is executed one time, the sort order is not changed

If this command is executed two times, the sort order is changed.

I have run many tests and these results are always consistent.

I don't have a problem with executing the command twice.

I am curious as to why this is happening, however.

Thanks,
Brad
  
       
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Wednesday, December 10, 2014 5:16 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Change Order within Access 2007 Report Group - Thanks! Plus Bonus Puzzler

If you reload the report view with the passed option (in OpenArgs), the code should only need to run once, so if I understand what you're doing, you may need a me.requery in the report routine that sets the sort order.

Charlotte



On Wed, Dec 10, 2014 at 1:25 PM, Brad Marks <bradm at blackforestltd.com>
wrote:

> 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
>
> --
> 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