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!

invalid reference to subreport 1

Status
Not open for further replies.

stupiet

Programmer
Aug 21, 2001
176
US
In VB I'm trying to reference fields in my subreport but for some reason it will not recognize this reference.

Here's the reference I wrote:

Reports!MainReport!SubReport.Report!Field1.Visible = False

When runinng this script I get the following error:

Run time error '2455':
You entered an expression that has an invalid reference to the property Form/Report.

Aren't I using the right reference? Please help! Thanks
 
It won't even work if it is used as follows:

Private Sub Report_Open(cancel As Integer)

Reports!MainReportName!SubReportName.Report!Field1.Visible = False

End Sub
 
Where is the subreport located? I would try place the code in the On Format event to the section of the main report that contains the subreport:
Code:
 Me.SubReportName.Report!Field1.Visible = False
It would make more sense to me to run the code in the On Format event of the section of the subreport that contains "Field1".



Duane MS Access MVP
Now help me support United Cerebral Palsy
 
You are right! I guess it does not know the field exists yet when you use it in the Open Event.

Appreciate the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top