Two or more subreport controls with the same report object

  • Thread starter Savvoulidis Iordanis
  • 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
 
A

Allen Browne

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
 
S

Savvoulidis Iordanis

Yes but this way it will change in both subreport controls which is not what
I want
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top