473,568 Members | 3,087 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set Control Source Value in SubReport at Runtime from MainReport

2 New Member
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?

Thanks
Bob
Jan 25 '12 #1
1 4583
Mihail
759 Contributor
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 NewControlSourc e 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

1
3651
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 version of safari(i.e.: MAC OS 10.3.7 and Safari 1.2.4). problem: control's value is not getting displaying at the first time when the page gets load, although the same piece of code would work if
6
2258
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 (=DateSerial(Year(),Month()+6,Day(). I placed it in the Control Source property. I want to save them to a table so I can use them on a report. So the 2 questions are: 1. How do you use a calculated...
5
18246
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 based on a query. In my report, I want a text box to display the number of times a certain value appears in a certain field (i.e. perform a ‘count'). I will be doing this for many values in many...
2
41629
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 attempting to set the control source of the text box to a different sum aggregate query using the expression builder. When I select the query and it's single field, single row field it inserts the...
4
2700
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 =TimeToSingle(TotalHours(,)) =TimeToSingle(BHolHours(,,)) I get problems when I include a text parameter Scale (control just displays #error)
1
1446
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 Source for days 1-14 and another for 15-31. To do this I put this into the report's open event: If (Day(date) < 15) Then here are the control source statements and the Else statement. End If On...
4
18789
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 want to select the minimum date for a record where the student = studentID.. The sql is pretty simple: "Select MIN(RecDate) from records_T where studentID = 1".
4
13931
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 "= List1.Column(0,2)" in design view. When I open the form, Text1 does not display the value of List1.Column(0,2) Am I missing something?
15
40628
beacon
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 to input data to one of three tables. I have a form (frmAddNewUser) that will add users to one of three separate tables (tblDefsAFP, tblDefsMSU, tblDefsWF) based on the selection of an option...
4
3840
doma23
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 "stated". txtSum in the control source has the following formula: IIF(cboCalcOption="calculated"; txtNumber1+txtNumber2; null) If the cboCalcOption is "stated" I need to allow user to input...
0
7692
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7913
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7659
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2099
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.