Results 1 to 6 of 6
  1. #1
    dbsitebuilder is offline Novice
    Windows 11 Access 2016
    Join Date
    Jan 2023
    Posts
    1

    VBA to add grouping level

    The project I work on has me adding grouping levels to every report I work on. We only need the footer, and it is always a specified set of fields to have the grouping level based upon. I have not found a way to programmatically add these levels. Has anyone had experience doing this?

    - Thanks, Kevin

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    10,744
    Happy to be corrected but so far as I know you cannot dynamically create groupings in a report. If the grouping is always the same why not create a report template then modify the fields as required.

    perhaps take a look at this link
    https://learn.microsoft.com/en-us/of...n.CreateReport

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    11,811
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    10,744
    Those links are the same as mine - you can change an existing group. What you canít do is add a new group

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    11,811
    I'll give you that. How about

    Code:
    Sub CreateLevel()
    Dim varGroupLevel As Variant
    
    DoCmd.OpenReport "rptTickets", acViewDesign, , , acHidden
    varGroupLevel = Application.CreateGroupLevel("rptTickets", "TicketGroup", False, False)
    DoCmd.Close acReport, "rptTickets", acSaveYes
    End Sub
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    3,824
    Here is what I used to do, had a preset report template with three grouping levels and update them as requested.

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 8
    Last Post: 01-29-2022, 03:42 PM
  2. Replies: 9
    Last Post: 08-18-2020, 02:32 AM
  3. 3 level query
    By czintak in forum Queries
    Replies: 4
    Last Post: 01-15-2019, 02:36 PM
  4. Linking Tables at the Table Level Vs. the Query Level
    By Tammy in forum Database Design
    Replies: 3
    Last Post: 12-03-2014, 01:34 PM
  5. Bi-level grouping
    By workuser in forum Reports
    Replies: 2
    Last Post: 03-18-2013, 10:46 AM

Tags for this Thread

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