PC Review


Reply
Thread Tools Rate Thread

Change GROUPING programmatically in reports

 
 
Dennis
Guest
Posts: n/a
 
      1st Jun 2010
Here's the deal: In Access 2003, I have a report. I need to be able to change
the "minor sort" programmatically via VBA (if I have to do that before I open
the report, that's okay.) This would involve making changes to the SORTING
AND GROUPING portion of the report. I would not need to SAVE those changes.
the minor sort needs to change based on a set of radio buttons. The
associated subtotals would need to be made visible/invisible based on that
grouping.

And assistance that someone could offer would sure be appreciated.

TIA!
 
Reply With Quote
 
 
 
 
KARL DEWEY
Guest
Posts: n/a
 
      1st Jun 2010
One way is to add a calculated field in your query feeding the report.
Have an IIF statement testing your radio buttons like this --
My_Sort: IIF([Forms]![YourForm]![Button1] = -1,
[YourDataTable].[FieldToSort], "0")

Leave off the quotes if it is a numerical field.

--
Build a little, test a little.


"Dennis" wrote:

> Here's the deal: In Access 2003, I have a report. I need to be able to change
> the "minor sort" programmatically via VBA (if I have to do that before I open
> the report, that's okay.) This would involve making changes to the SORTING
> AND GROUPING portion of the report. I would not need to SAVE those changes.
> the minor sort needs to change based on a set of radio buttons. The
> associated subtotals would need to be made visible/invisible based on that
> grouping.
>
> And assistance that someone could offer would sure be appreciated.
>
> TIA!

 
Reply With Quote
 
Dennis
Guest
Posts: n/a
 
      4th Jun 2010
WOOHOOO!!!

Thanks Marshall! You did it again. that was exactly what I was looking for!!!



"Marshall Barton" wrote:

> Dennis wrote:
>
> >Here's the deal: In Access 2003, I have a report. I need to be able to change
> >the "minor sort" programmatically via VBA (if I have to do that before I open
> >the report, that's okay.) This would involve making changes to the SORTING
> >AND GROUPING portion of the report. I would not need to SAVE those changes.
> >the minor sort needs to change based on a set of radio buttons. The
> >associated subtotals would need to be made visible/invisible based on that
> >grouping.

>
> Another way is to modify existing entries in the Sorting and
> Grouping list in the report's Open event.
>
> If Forms!theform.theradiobutton Then
> Me.GroupLevel(N).ControlSource = "this field"
> Else
> Me.GroupLevel(N).ControlSource = "that field"
> End If
>
> Check the GroupLevel topic in VBA Help.
>
> --
> Marsh
> MVP [MS Access]
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically control Report Grouping & Sorting via Form Jen S Microsoft Access Form Coding 1 26th Jul 2009 04:06 PM
Adjust grouping levels programmatically =?Utf-8?B?UGVuZHJhaWc=?= Microsoft Access Reports 2 23rd Oct 2007 08:44 AM
c# programmatically grouping a range of cells =?Utf-8?B?bWlsZXpk?= Microsoft Excel Programming 0 6th Aug 2007 09:20 PM
Changing report grouping programmatically =?Utf-8?B?YW1iZXI=?= Microsoft Dot NET 1 14th Oct 2004 08:39 PM
Reports and grouping rbruhn Microsoft Access Reports 2 18th Jul 2003 09:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:39 PM.