Solved

Assign value to a RptTextBox in DataReport

Posted on 2000-02-24
5
1,601 Views
Last Modified: 2008-03-03
Hi !

I have a report (rptTest) with a rtpTextbox called "Fullname". I want, from my VB project, assign the value of a variable called "sCustomerName" to the rptTextbox in my datareport.

I DON'T WANT to use the DataReport Connection object, just simply assign the value !

I've tried this but it doesn't work.
"rptTest.Sections(3).Controls(1).Item.Text = sCustomerName" where Controls(1).Item is the rptTextbox.

Couls anyone help me with providing some code ?

Thanks to all !

0
Comment
Question by:sruel
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:gcs001
ID: 2554740
The Data Report's TextBox control is a data-bound control that can only display text from a database at run time.

You will thus have to make it a bound control by assigning values to the Data Member and Data Field properties.

You could try using the Label control instead and then assign the variable to the Caption property.

Regards.
Grant.
0
 
LVL 12

Expert Comment

by:roverm
ID: 2554753
try this:
rptTest.Sections(3).Controls("rptTextbox").Value = sCustomerName

Else, replace the textbox with a rptLabel, then use this code:

rptTest.Sections(3).Controls("lblMyLabel").Caption = sCustomerName

I use this al the time ! This works great!

D'Mzzl!
RoverM
0
 

Author Comment

by:sruel
ID: 2554880
I've tried with a rptLabel but i get the message "Invalid DataSource" on the .Show !!! What is going there in my case ???
0
 
LVL 12

Accepted Solution

by:
roverm earned 100 total points
ID: 2557134
U have to set a datasource for the entire DataReport, else nothing will work!
Just place a ADODC on a form and connect the DataReport to that!

D'Mzzl!
RoverM
0
 

Author Comment

by:sruel
ID: 2557551
It works ! Thanks to all !
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question