472,344 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,344 software developers and data experts.

Set Control Source Value in SubReport at Runtime from MainReport

I have a report and a sub-report. I want to reuse the sub-report in the main report, but change the Control Source of a TextBox for each use. I am coding:
Expand|Select|Wrap|Line Numbers
  1. Reports![rptMain]![SubReportControlName].Report![Title Label].ControlSource = "=""Value A"""
I consistently get:

Run-time Error 2455 You entered an expression that has an invalid reference to the property Form/Report.

The code is in the Report Open event of the main report. What am I missing or not seeing?

Jan 25 '12 #1
1 4385
759 512MB
What is Value A ? It seems to be a variable, but become a string in your code.
Try to debug that by slightly change your code:]

Expand|Select|Wrap|Line Numbers
  1. Dim NewControlSource As String
  2. NewControlSource = "=""Value A"""
  3. Debug.Print NewControlSource
  4. Reports![rptMain]![SubReportControlName].Report![Title Label].ControlSource = NewControlSource
Of course you will obtain the same error message but now, when the code stop, you can see in Immediate window (press CTRL+G to open this window) that the value for your NewControlSource is all the time this string: ="Value A". And this not seems to be an SQL string.
Jan 25 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: aquimr | last post by:
Hi, I'm using input hidden control's value in the javascript function. same code is working fine on all other browser except a specific...
by: Mark Lees | last post by:
I've created some fields that calculate future dates. The way they are set up they do not save to a table. This is the expression I used...
by: Cro | last post by:
Hello Access Developers, I'd like to know if it is possible to perform a count in an expression that defines a control source. My report is...
by: Bob | last post by:
I've got a bound report with a query as the record source. I'm adding a total to the footer and have inserted a text box to display it. I'm...
by: VivN | last post by:
I want to use an expression as the control source for a text box in a report (Access 2000). Whilst I have sucessfully used these simple ones ...
by: rinmanb70 | last post by:
For a field on a report, I'm trying to use an If/Then statement to set the Control Source depending on the day of the month. I need one Control...
by: Anja | last post by:
Hi everyone, I am trying to use the expression builder to create input to a control in an Access report. I have a table called Records and I...
by: Lou O | last post by:
Is it possible to use the row (index) of a list box as control source Property for a text box? Example: Text1.ControlSource Property is set to "=...
by: beacon | last post by:
Hi everybody, Using Access 2003. I'm trying to dynamically set the record source for the current form and set the control source for a text box...
by: doma23 | last post by:
Hi, I have 4 controls, 3 text and 1 combo: txtNumber1, txtNumber2, cboCalcOption, txtSum. cboCaclOption has two possible value: "calculated" and...
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.