To get the full benefit of subreports they should be bound to a recordsource (table or query) and use the Link Master Fields
and Link Child Fields
properties of the Subform/Subreport control to "sync" the subreport data with the parent record.
Say you have a [Users] table
userID
------
Gord
Tim
and a [UserTraffic] table
userID trafficDate downloadMB
------ ----------- ----------
Gord 2013-04-26 366
Gord 2013-04-25 442
Tim 2013-04-26 890
Tim 2013-04-25 212
Your main report [UserReport] is bound to [Users] and contains a subreport control based on the report [UserTraffic_subreport]
![subreport1.png](https://i.stack.imgur.com/3o1Uw.png)
When you use that report in your Subform/Subreport control on your main form...
![mainreport.png](https://i.stack.imgur.com/Dmjak.png)
...be sure to set the Link Master Fields
and Link Child Fields
properties...
![properties.png](https://i.stack.imgur.com/FD4WW.png)
...so your report will come out like this:
![preview.png](https://i.stack.imgur.com/k9Tvj.png)
Note that this example required no VBA code at all.
Edit
The same principles apply when adding a chart to a report. The following report displays user traffic by date, so the Record Source for the main report is
SELECT DISTINCT trafficDate FROM UserTraffic ORDER BY trafficDate;
The report uses a Chart control instead of the Subform/Subreport control...
![design.png](https://i.stack.imgur.com/nsBDx.png)
...and the properties of the Chart control are...
![properties.png](https://i.stack.imgur.com/UvY8E.png)
The resulting report looks like this
![preview.png](https://i.stack.imgur.com/TaLoO.png)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…