Two or more subreport controls with the same report object

  • Thread starter Thread starter Savvoulidis Iordanis
  • Start date Start date
S

Savvoulidis Iordanis

How can I have two (or more ) subreport controls in a report
based on the same report object (which initially is not based in any query
object).

I want to set a query object to the subreports at runtime so that I can pass
diffent
criteria. I don't want to use filtering, because the records are to many to
pass them all
locally through the network and then filter them on the PC
 
In the Open event of the subreport, you can create a string containing the
desired SQL statement, and assign it to the RecordSource property. (You may
find Report_Open fires more than once in some versions of Access.)

If the report is opened through a form (because you don't allow your users
anywhere near the Database window), another alternative is to change the SQL
property of the QueryDef before you OpenReport:

dbEngine(0)(0).QueryDefs("MySubreportQuery").SQL = "SELECT ...
DoCmd.OpenReport "MyReport", acViewPreview
 
Yes but this way it will change in both subreport controls which is not what
I want
 
Back
Top