Results 1 to 6 of 6
  1. #1
    dmatherton
    Guest

    Automating Report Production

    I am putting together a Report Requester interface. I've got the thing working (pretty much) but want to let users manipulate Grouping levels for a report BEFORE it gets opened/displayed.

    Does anyone out there have any thoughts on where I should start looking?

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Automating Report Production

    Hi,
    I think you need to be looking at the CreateGroupLevel method and the GroupOn property. You can look them up under the VBA Help in Access for more details.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    dmatherton
    Guest

    Re: Automating Report Production

    Thanks for the tip. However, I am still getting stuck:

    I can create a new group level, but when I try to work with the new report section .....

    Reports(strReportname).Section(acGroupLevel1Header )

    I get an error to the effect that the section does not exist.

    I use the following code line to create the group (straight out of help):

    CreateGroupLevel Report, astrGroups(iGroupCount), True, False

    astrGroups(iGroupCount) selects a string from the array, which contains a valid field name.

    This line seems to work, as it does create a new group header. however, I can't reference the new header in code.


    Any ideas?

    Ta.

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Automating Report Production

    Hi,
    Sorry for the delay in responding! Can you post the exact code that is causing the error and what the error message is? I'm assuming the report is open in design view otherwise the CreatGroupLevel method shouldn't work.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    dmatherton
    Guest

    Re: Automating Report Production

    After hours of stress, I found that I'd typed the CreateReportControl syntax incorrectly. Move one comma and everything works fine.

    However, I am now getting gpf in MSACCESS.EXE when I try to produce a report with more than one "GroupBy" level.

    Thanks for the help.

    d.

  6. #6
    Star Lounger
    Join Date
    Apr 2002
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automating Report Production

    I have one report through user input can be grouped on four varying factors. (They also can select the sort-order for the report.) For the report to work, I use IIF statements in the Sorting and Grouping Field/Expression as well as for data source of the text box at the top of each group header. The IIf statement picks up data through the form the user selects the grouping options with.

    Basically, the IIf statement is something like:

    =IIf([Forms]![mnuReportFinDetail]![txtGroup1]="L", [strLOB], IIf([Forms]![mnuReportFinDetail]![txtGroup1]="F", [dtmFU], IIf([Forms]![mnuReportFinDetail]![txtGroup1]="R", [strRep], [strStatCode])))

    You could use code in the report's OnOpen event to turn off the extra grouping levels if they are not needed.

    Thus far {knock on wood} this method is working without complaint.

Posting Permissions

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