Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Lewes, East Sussex, Sussex, United Kingdom
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Linking subreports (A2002 SP3)

    I have a fairly complex invoice report which consists of a main report, and various subreports within the main report. One of these subreports contains the layout of detail page of the invoice.

    The problem is that we have 6 different layout subreports

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Linking subreports (A2002 SP3)

    The subreport is displayed within a subreport control. One property of such a control is its "sourceobject"- this specifies what subreport you want displayed inside the control.

    You should be able to programmatically set the sourceobject in the "On Open" event of the Main report.

    You could pass the report a value as an OpenArgs parameter, then inspect that to decide which subreport to show.
    Regards
    John



  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Lewes, East Sussex, Sussex, United Kingdom
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Linking subreports (A2002 SP3)

    John

    Thanks for that, but according to the Access Help :

    Note You can't set or change the SourceObject property in the Open or Format events of a report.

    Nick

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Linking subreports (A2002 SP3)

    What you do is have 1 report with all six subreports layered on it. Pass an argument into the report to hide all but the one you need for that layout.
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Lewes, East Sussex, Sussex, United Kingdom
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Linking subreports (A2002 SP3)

    Charlotte

    That is an excellent suggestion, which would solve the problem perfectly.

    Thanks for that

    Nick

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Linking subreports (A2002 SP3)

    I thought I must have made a mistake then by assuming that the sort of thing that works for forms also works for reports.

    But I have just been testing this and it does work.

    See the attachment.

    Open the report from the form.
    Regards
    John



  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Lewes, East Sussex, Sussex, United Kingdom
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Linking subreports (A2002 SP3)

    John

    You're right. It does work, but only in the Report Open event. I tried it in the Detail Format event, and it did not like that.

    So much for Access Help !

    Thanks

    Nick

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Linking subreports (A2002 SP3)

    Detail format is too late. You can only change the subreport in the Open event of the parent report. What's wrong with doing that?
    Charlotte

Posting Permissions

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