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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change visible property in code during runtime

Status
Not open for further replies.

MICKI0220

IS-IT--Management
Jul 20, 2004
337
US
I have two reports that use the same subreport. On one report I want all the fields of the subreport to show, on the other report I want one of the text box's visible property to change to false, or no etc. Can someone help me with the correct code to do this?
 
in the main report open use this code


me.subreportcontrol.report.control.visable=x

 
Slight spelling error on PWise's post:

me.subreportcontrol.report.control.visible=x

x being True or False


 
This is the code I have. It errors and says the report is mispelled or doesn't exit or isn't open. I put it in the open of the main form. Is that right?


Reports![jobinfo subreport].[prevailing wage2].Visible = False
Reports![jobinfo subreport].[prevailing wage2_label].Visible = False
 
if you want to put this in a form make sure that the report is open
Code:
Reports[i]!Reportname[/i]![jobinfo subreport][i]!Report[/i]![prevailing wage2].Visible = False
Reports[i]!Reportname[/i]![jobinfo subreport][i]!Report[/i]![prevailing wage2_label].Visible = False

i would put it in the report itself
Code:
[i]me[/i]![jobinfo subreport][i]!Report[/i]![prevailing wage2].Visible = False
[i]me[/i]![jobinfo subreport][i]!Report[/i]![prevailing wage2_label].Visible = False
 
I cut and pasted that code in and I get this error

Runtime error '2455'
You entered an expression that has an invalid reference to the property Form/Reports.

The main forms is where I put this code in the Open event.
The subreports name is [JobInfo subreport], the object that needs to be visible or not depending on what report button I choose is [Prevailing Wage2] and [Prevailing Wage2_label], these are fields on the reports. Hope that information helps.
 
Hi MICKI0220,

I think there is somthing lissing in your syntax, and I'll try to explai.

the report has a subreport as a control. the subreport control is in fact NOT the subreport itself, it is an object that contains a report. so the subreport object has a propertiy named 'source object' what this is the name of your actual sub-report. and the sub-report has textbox/label as his own control.


so you should try in your code as follows:
Code:
 me.[jobinfo subreport].Report.[prevailing wage2].Visible = False
me.[jobinfo subreport].Report.[prevailing wage2_label].Visible = False

hope it help
Ja

here is a link discussing the 'subform' issue, but it might help also on subreports.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top