How to specify variables to define content of subreports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stewey

    How to specify variables to define content of subreports

    I am using the sendobject function to email a report out to various members of staff.

    Essentially I have two reports.

    Report1 contains the subreports, and is the report that is emailed

    Report2 displays records matching two criteria: Total Points >150, and one of the Houses (there are 4 Houses - Barton, Furley, Harvey or Weil)

    Report2 is replicated 4 times on Report1 - the idea being that each House has its own report

    At the moment, when I run the report, I have to type in each of the 4 houses. I want to add this report into an existing code so that it automatically picks the condition from a string (strSoL) in the table and I don't have to type it in.
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    When report 1 is based on a query for each of the houses, a subreport in the detailsection based on a query with the >150 criteria that's linked to the main report1 will automatically filter the data for you.

    Clear ?

    Nic;o)

    Comment

    • stewey

      #3
      do you mean nico that i need to have four separate queries, one for each of the houses? Is there no way to just use the same query four times with a different variable specified each time?

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        No, I propose to use a main report with one query extracting the four houses from a table (you could use e.g. a Group By query when houses are only recorded in detail records, or a select query when you have a tblHouse.

        Next place the sub-report in the detail section and accept the link the Access report wizard proposes.

        Thus the subreport will occur as many times as houses are selected on the main form.

        Keep in mind that the House Header needs to be on the main form as the page headers on a sub report are suppressed.

        Comment

        Working...