That doesn't happen in my copy of Access.
If there are no records in the subreport, nothing gets printed.
What you are asking for can be done by testing the HasData property of the
report in the subreport control, in the Format event of the main report
section, or by performing a DLookup() on related records to see if there are
any, and then toggling the Visible property of the main report section that
contains the subreport or setting the runtime properties PrintSection and
MoveLayout. However, it makes no sense to me to do it that way.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Tom" <no***@email.co m> wrote in message
news:4c******** *********@newsr ead3.news.atl.e arthlink.net...
The subreport has titles and a logo. It prints when there are no records
marked Yes in the IncludeInReport field.
Tom
"Allen Browne" <Al*********@Se eSig.Invalid> wrote in message
news:42******** *************** @per-qv1-newsreader-01.iinet.net.au ... Tom, I would never consider doing that in code, when you could elimiate
the records in the *query* that the subreport is based on, so that no
code is needed.
Is there a special reason you wish to use code?
"Tom" <no***@email.co m> wrote in message
news:Bs******** *********@newsr ead3.news.atl.e arthlink.net... Allen,
Thanks for your response!
Please reread my post. I want to know how and where to code to prevent
printing the subreport when there are no records marked Yes in the
IncludeInReport field.
Thanks,
Tom
"Allen Browne" <Al*********@Se eSig.Invalid> wrote in message
news:42******** *************** @per-qv1-newsreader-01.iinet.net.au ...
Create a query to use as the RecordSource of your subreport.
In the Criteria row of the query, under the IncludeInReport field,
enter:
True
"Tom" <no***@email.co m> wrote in message
news:%1******** *********@newsr ead3.news.atl.e arthlink.net...
>I have a subreport that can contain one or two pictures per page. The
>subrepor t is similar to an appendix to the main report. The
>recordsour ce contains a field "IncludeInRepor t" (Yes/No) for each
>picture record. What code do I use and where does it go to prevent
>printing the subreport if there are no picture records marked "Yes" in
>the "IncludeInRepor t" field?