Solved

Assign value to a RptTextBox in DataReport

Posted on 2000-02-24
5
1,521 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
It works ! Thanks to all !
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now