Jim said:
Is it possible to use VB code to specify the source of a subreport in the
detail section of a main report, and linking fields as well. If so, what
code should I use and what event would this be set in?
A subreport's (or report's) RecordSource property can only
be set in the Open event of the subreport, and even then it
can only be done the first time the subreport is opened.
The code is pretty straight forward:
Me.RecordSource = queryname
or
strSQL = "SELECT . . . "
Me.RecordSource = strSQL
I'm pretty sure that setting the LinkMaster/Child properties
for the subreport control on the main report can only be
done in the main report's Open event.
Me.LinkMaster = "controlname"
Me.LinkChild = "fieldname"
If you were think of trying to do this for each main report
detail record, forget about doing it this way.