473,614 Members | 2,361 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 4586
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
3662
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
2259
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 field that doesn't save to a table in a report?
5
18256
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 fields so do not wish to have scores of queries to build my report.
2
41635
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 following in the control source box for the text box. =! I've tested the query (...
4
2703
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
1449
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 one report this works fine, but after I copy and paste the code into another report, when I try to...
4
18803
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
13936
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
40641
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 button from an option group on the same form. I have a textbox (txtNewUser) that accepts the name of...
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 some number in txtSum control, else it would be calculated.
0
8179
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8621
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8427
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6087
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5538
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4049
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4119
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1712
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1421
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.