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

Subreport VBA

Status
Not open for further replies.

jt463

IS-IT--Management
Nov 23, 2005
134
I have a 3-part report that, until now, I have had users create each part separate and then pull in to an Excel spreadsheet manually - which was quite cumbersome.

I have just started playing around with subreports and am able to accomplish automating the 3-part manual process by combining the parts on to one report that has two subreports. It works great! With one exception...

My subreport (COOtherSelectionsFlooring) has several label objects that I will hide/show based on what house plan is being used. This worked great with the report when it was by itself with the code below, but now when I run it (as the OpenReport code for the subreport), I get an error message:

"Run-time error '2451': The report name 'COOtherSelectionsFlooring' you entered is misspelled or refers to a report that isn't open or doesn't exist."

Code:
Reports!COOtherSelectionsFlooring.Room1J.Visible = True

This code is in a Public Function that my "on Open" code calls when the COOtherSelectionsFlooring subreport opens within my main report.

I have tried the following combinations to no avail:

Code:
'First Attempt
[COOtherSelectionsFlooring].Reports!Room1J.Visible = True
'RESULT: Error - "Object Required"
'Second Attempt
Reports![COOtherSelectionsFlooring].Room1J.Visible = True
'RESULT: Error - "Run-time 2451..."
Reports!COOtherSelectionsFlooring!Room1J.Visible = True
'RESULT: Error - "Run-time 2451..."

Any help would be greatly appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top