Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2002

    Unanswered: vba group header


    I'm trying to programmatically create a group header(s) based on a response in a form.

    Right now I'm forcing the text value for testing but this value would be pulled from a case statement triggered by the user.

    This is the code in the report open event.

    Me.GroupLevel(0).ControlSource = "ST"

    Me.GroupLevel(0).GroupHeader = True

    Me.GroupLevel(0).SortOrder = False
    Me.GroupLevel(0).GroupOn = 1
    Me.GroupLevel(0).GroupInterval = 1
    Me.GroupLevel(0).KeepTogether = 2

    I've been getting two errors: a) there is nos sorting or group level for the group level number you're using and b) this operation is only available in design mode.

    Is there some other place this code should be placed? If not on the open statement then where and how can it be triggered from a form?

    Thanks for the help.


  2. #2
    Join Date
    Feb 2004
    Chicago, IL
    You are probably going to have to find another approach. What you are actually doing is changing the design of the report on the fly. In 2000 and later versions, this will not work in a multi user environment, since you need exclusive access to the database to make any programming changes.

    I would suggest adding the header and hiding it if necessary, or have two reports (not the best approach, but possibly the only feasible one).

  3. #3
    Join Date
    Dec 2002

    Two or more reports

    I thought about doing two or more reports...but unfortunately, the way the system is set up, the user has an option of setting two group levels each with five variables. So I'd need a bunch of reports, each with a different header.



  4. #4
    Join Date
    Dec 2002


    The more I think about this the more it doesn't make sense.

    Why have commands to create group levels and such if you can't use them?

    At the moment, the db isn't a multiuser environment. At any given moment only one user will be using it. (For now)

    With that said, could I open the report in design mode and make set .visible = False then modifiy using the form? Or maybe have a "base" report and create copies on the fly from that the user can modify that would be deleted after it was/is used.

    The problem with mulitple reports is I think I'll have somethign like 25ish reports with the same data but just different header groupings. Maybe I'm getting hung up on this but it seems like Access should be able to handle creating a header group on the fly.


  5. #5
    Join Date
    May 2008
    Even if it's a bit late, but other's could run accross the same thing and it's still in the google hit list... :-)

    CreateGroupLevel is your answer. After that you can set all these properties.

  6. #6
    Join Date
    Feb 2004
    One Flump in One Place
    Quote Originally Posted by techElefant73
    Even if it's a bit late
    3 and a half calendar years. A mere trifle in IT years.
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts