Subreport within a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 tables: Main and Detail (and a lot of small linked ones as well).
I'm trying to display the detailed records with line_item# (key on contract#,
type) from the Detail table and also the main header record (key on
contract#, type) from the Main table. The master child link is on Contract#
and Type (if I need this please provide the steps). Do I need to build 2
queries to get the report to work, or do I build 1 query that links the Main
and Detail tables together? Could you please steer me in the right direction?

Thank you!
 
gg said:
I have 2 tables: Main and Detail (and a lot of small linked ones as well).
I'm trying to display the detailed records with line_item# (key on contract#,
type) from the Detail table and also the main header record (key on
contract#, type) from the Main table. The master child link is on Contract#
and Type (if I need this please provide the steps). Do I need to build 2
queries to get the report to work, or do I build 1 query that links the Main
and Detail tables together? Could you please steer me in the right direction?


Generally, you can create one query that joins the two
tables. Add both tables to the query, then drag each
linking field from one table to the other. With that done,
drag the desired fields from both tables to the query's
field list.

Base the report on the query and use Sorting and Grouping
(View menu) to specify what field(s) you want to group the
data by, probably one for contract# and another for type.
The contract data would go in the contract group header
section and the "child" data would go in the detail section.
 
What determines when you would need to link the child/master to the main
report vs. 1 query that joins the tables (as in this case)?

Appreciate your suggestions, Marshall! Thanks.
 
I'm not sure I understand what you're asking.

If you can get what you want by joining the two tables in a
query, the join provides the linking and you do not need a
sub report at all. The group header and footer section's
provide a place for the parent data (and any sub or grand
totals) while the detail section is for the child data.

If you really need to use a sub report, then you do the
linking using the sub report control's Link Master/Child
Fields properties. In this arrangement, subtotals and a
grand total are more complicated, but not outrageously so.
 
Back
Top