Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show or Hide Subreport

Status
Not open for further replies.

cantona

Technical User
May 20, 2001
121
GB
Hi,

Ive got a report that contains a subreport in the details section of the report. I would like to display this subreport in all cases unless the field offer_code has a value of '33'. If offer_code has a value of '33' i would like to display a field called comments instead. Whats the best way to do this? Ive tried putting some code in the onFormat section of the main report along these lines...

If Me.Offer_Code = 33 then Me.Comments.Visible = True and Me.Sub_Rpt.Visible = False

This doesnt however work! can anyone help?
 
If I understand you, you need to add the code to the Current Event for the main form and the After Update event for Offer_Code.
 
Try:
Code:
   Me.Comments.Visible = (Me.Offer_Code = 33)
   Me.Sub_Rpt.Visible = (Me.Offer_Code <> 33)
This assumes you have a control in your report section named Offer_Code.

Duane MS Access MVP
Now help me support United Cerebral Palsy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top