how to make subforms invisable

S

Simon

I have a report with a text box (BrochurePrices) which dispaays -1
or
0 depending if true or faule

I also have a sub report that has the prices. What i would like to do
if BrochurePrices is True then i would like subreport to be visable
if
false then subreport to be invisable


Any help would be great


Thanks
 
K

Ken Sheridan

In the Format event procedure of whichever section of the report the
subreport is in put:

Me.srPrices.Visible = Me.BrochurePrices

where srPrices is the name of the subreport control, i.e. the control in the
main report which houses the subreport, not that of the underlying report
object, unless both have the same name of course. NB you need to open the
event procedure in the VBA window to enter the code. To do this either
select the Format event property in the section's properties sheet in design
view, click on the build button (the one on the right with 3 dots and select
Code Builder, or select [Event Procedure] from the drop down list and then
click the build button.


BTW why not use a check box for BrochurePrices? A checked or unchecked box
is likely to be more intuitively understandable to the reader of the report
than the underlying values of -1 or 0. Alternatively you could format the
text box as Yes/No or True/False.

Ken Sheridan
Stafford, England
 

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