Subreport to filter on id field in main report

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Subreport to filter on id field in main report

Post by Leesha »

Hi,

I have a report that is set to sort on the [last name]. There is a header and footer for [last_name]. This works fine. The information is the header is the demographich information for the person and the detail section contains results of the study.

I need to embed a subreport into the [last_name] header that will sort the data for the [last_name] that is described above. The reason I'm setting it up this way is that there can be be multiple rows of information (which is stored in a separate table) to 1 row of demographic information per person described above.

My problem is that when the report opens, the information in the subreport runs for every person in the subreport vs being filtered by the last name for the main report. I don't want to have the user have to run the reports one at a time by clicking on a name in a list as this will be sure to cause complaints. Is there a way to filter [last_name] in the subreport according to the [last_name] that is in the header of the report?

Thanks,
Leesha

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Subreport to filter on id field in main report

Post by HansV »

Have you set the Link Master Fields and Link Child Fields properties of the subreport as a control on the main report? Since you group the main report on Last_Name, you should probably use the Last_Name field.

(I myself would use the unique key of the person table to group on, and use that as Link Master Fields/Link Child Fields)
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Subreport to filter on id field in main report

Post by Leesha »

What a great concept!!! I've never really used subreports before and hadn't even thought to see if child fields were there. I'm going to use the unique ID for the person vs last name. :-)

Thanks!
Leesha