The example I quoted uses the code below. I have a report "Rpt1". In that there is a charts called "Graph11" and a text box called "Location".
Based on options selected in the calling form, I set strings for the record sources of the report and the chart, and also for the text box. Further, I set up a string for the link between the chart and the report.
The code then opens the report in design view,
sets the record source for the report,
sets the record source for the graph,
sets the chaild and master fields for the link between the report and chart,
sets the control source for the Location text box,
and finally saves the report.
I then open te report as usual for the ser to see it.
The echo false / true bits make these changes invisible to the user, althouhg it does take a little longer for the report to appear to them.
DoCmd.Echo False, ""
DoCmd.OpenReport "Rpt1", acDesign, "", ""
Reports!rpt1.RecordSource = stSQLRpt
Reports!rpt1!Graph11.RowSource = stSQLChart
Reports!rpt1!Graph11.LinkChildFields = stLink
Reports!rpt1!Graph11.LinkMasterFields = stLink
Reports!rpt1!Location.ControlSource = stLocation
DoCmd.Close acReport, "Rpt1", acSaveYes
DoCmd.Echo True, ""