Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Assign value to a RptTextBox in DataReport

Posted on 2000-02-24
5
Medium Priority
?
1,814 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 300 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

670 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