Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Report also used as subreport (2003)

    I have a report - "Personal Details" - which prints a subset of personnel details held in a DB; this can be run as a report in its own right. The same report is also used as a sub-report in a more comprehensive report - "Contract and Personal Details"
    The larger report has been built this way so that if the user requires changes to the personal details report, they are automatically carried through in the more comprehensive report.
    The user has asked for a couple of pieces of information to be suppressed when running "Personal Details" as a report on its own, but wants them printed in the larger "Contract and Personal Details report".
    If I put code to make these controls invisible in the "Personal Details" On Format event, this will carry through to the larger routine, which is not what's required.
    I don't know how to set up a 'flag' in VBA which I can set to different values depending on which report has been called in a way which makes the 'flag' accessible in different code modules.
    Finally, I don't know how to refer to controls on a sub-report in the code module for the big report.
    What's the best way of dealing with this user request, please?
    Thanks
    Silverback
    Silverback

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report also used as subreport (2003)

    I'd create separate reports.

    I don't think you can refer to controls on a subreport in code behind the main report, it doesn't make sense.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report also used as subreport (2003)

    Hans
    Sorry for making this sound much more complicated than it is. I've got it working, now.
    The reports are called from a form where the user chooses one or other of the reports via an option group. I now have an invisible, unbound control on the form to which the option value is assigned when the preview report command button is clicked. This control is accessible in the On Format routine of the PersonalDetails Report/Sub-Report and so can be used to establish which of the two reports the user chose. Knowing that, the relevant report information is made visible or invisible as required.
    Thanks
    Silverback
    Silverback

Posting Permissions

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