Controlling Visibility of a Subreport

  • Thread starter Thread starter JohnB
  • Start date Start date
J

JohnB

Hi. Is it possible to have some ON Print code in a
Reports Header section that makes a Subreport visable
only if certain other criteria are met?

For example, say I have fields txtSubject and txtYear in
a reports StudentID header, plus a subreport called
rptStudentSubreport. Can I add On Print event code to
this header that makes the subreport appear only when the
content of txtSubject is ECS and the content of txtYear
is Yr4?

Is this possible and if so what would the code look like?

Thanks in advance, JohnB
 
JohnB said:
Hi. Is it possible to have some ON Print code in a
Reports Header section that makes a Subreport visable
only if certain other criteria are met?

For example, say I have fields txtSubject and txtYear in
a reports StudentID header, plus a subreport called
rptStudentSubreport. Can I add On Print event code to
this header that makes the subreport appear only when the
content of txtSubject is ECS and the content of txtYear
is Yr4?

You need to use the Format event for this kind of thing.

Me.subreportcontrol.Visible = (Me.txtSubject = "ECS") _
And (Me.txtYear = "Yr4")
 
Thanks for this Marsh. Ill take some time to look at the
Format event - I have no knowledge of it. Ill get back to
you if I have any problems with your suggested code.
Thanks again, JohnB
 
Back
Top