Database Reference
In-Depth Information
Figure 8-13. Completed subreport
7.
Test the report by selecting the Preview tab. The report prompts you for an AuthorId
value: type in a valid value (111 or 113 should work). The report should display the
appropriate data for the id you entered.
Adding the Subreport to the Main Report
Now that you're confident that your subreport works, let's wire it up to the main report:
1.
With the first report open (the Documents report), there are two ways you can
add a subreport: you can either drag the report you've designated as a
subreport from Solution Explorer onto the parent report, which automatically
sets the appropriate properties of the subreport; or you can drag a SubReport
control from the Toolbox onto the parent report and manually set the
properties. How you choose to do it isn't important, as long as the appropriate
properties are set; you access them by right-clicking the subreport and
selecting Properties. In the Subreport Properties dialog, make sure the correct
report is selected as the subreport.
2.
Select the Parameters page, and add the parameter that is being passed from
the parent report to the subreport—in this case, AuthorId.
3.
You need to make a change to the parent report so your data is displayed
correctly. Right now, the table lists all of the users. If you kept it that way, the
report would list all the users and then list all the documents. Instead, you
want it to list the users and associated documents, grouped by user. To do this,
delete the table on the parent report and, from the Report Data window, drag
the Name, Intro, and Title fields from the dataset onto the report, as shown in
Figure 8-14. Now, when you run the report, it lists a user and that user's
documents, as shown in Figure 8-15.
Search WWH ::




Custom Search