Results 1 to 5 of 5
  1. #1
    rsarracini is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    3

    Multiple Group Header Sorting via VBA

    I have a report with3 Group Headers. I would like to let the user choose if they want to seethe three headers or drop it down to just the two. One of the three alwaysneeds to be there, but depending on whether the other two are selected, it can bethe first or the last Group header.
    Many posts mentionhiding a group header, which I do. The problem with hiding is that thesort hierarchy still applies resulting in a sort result that isn't obvious whenviewing the report (as the hidden group heading still has sorting control).
    The order of thegroup headings can be manually changed in the "Group, Sort and Total' panein the report design. I'm really looking for how to do the same thing inVBA (eg use the 'move up' and 'move down' buttons). By hiding the group headingI don't want and moving it to bottom, the sort occurs as required.





  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,616
    This can probably be done programmatically but I think even the code would have to open the report in design view, edit report settings, then save the report then reopen again in Report or Preview or Print. I had to resort to that process for a couple of reports, but not to change grouping, other issues were involved.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Reports is not the place to do custom programming.
    Queries maybe, but reports are just for looking....
    just make a report for each different sort, let user pick.

  4. #4
    rsarracini is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    3
    Thanks, I'm actually making other changes to the report programmatically, so opening the report in design view is fine (the user makes selections prior to 'running the report'. The code then opens the report in design view and makes changes before opening it in report view). What I'd like to understand is what is the VBA coding to effect the change in Group Header sorting as per my original description.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,616
    Afraid I don't know. That would be a learning experience for me as well.

    Bing: Access VBA report group

    Maybe this will help http://bytes.com/topic/access/answer...ader-using-vba

    I might be wrong about having to open in design view.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-06-2014, 10:58 AM
  2. Multiple columns with wide group header
    By jeh35 in forum Reports
    Replies: 3
    Last Post: 08-22-2013, 12:09 AM
  3. Replies: 0
    Last Post: 02-25-2013, 04:43 PM
  4. Group Header
    By SusanHRO in forum Reports
    Replies: 5
    Last Post: 08-10-2011, 01:59 PM
  5. columns for group detail but not group header?
    By Coolpapabell in forum Reports
    Replies: 0
    Last Post: 08-21-2009, 08:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums