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

Dynamically change value in textbox

Posted on 2002-03-05
Last Modified: 2008-02-01
The code below dynamically change the a label in data Report. How to dynamically change a textbox data in Data Report?

Me.Sections("section1").Controls("label1").Caption= "Hello"

Question by:chwankok
LVL 50

Expert Comment

by:Ryan Chong
ID: 6841051
What don't you update the DataSource of Data Report??
LVL 50

Expert Comment

by:Ryan Chong
ID: 6841052
> What don't you update ..
"What" should be "Why"

Expert Comment

ID: 6841055
Hi chwankok

Me.Sections("section1").Controls("Text1").Text = "Hello"

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.


Author Comment

ID: 6841072
It does not work and i tried this too
Me.Sections("section1").Controls.Item("Text1").Text = "Hello"

i have an if condition to determine what value to display.  

LVL 50

Expert Comment

by:Ryan Chong
ID: 6841137
Isn't it what your display show in "Detail Section" ? What you intend to change > a field's value or free text value?


Accepted Solution

raama16 earned 20 total points
ID: 6841213
Sorry ! You can not change dynamically the value of text box in the data report but you can change the label caption !!! I think it is the drawback of Data report !!!


Expert Comment

ID: 6842167
you can do this in the sql statement.
what database do you use?
for access db use the iif and or switch statement
IIf(expr, truepart, falsepart)

ex select iif(fieldA= 1,"Red","Green") as myfield from tablea

you may use the switch statement.
Switch(expr-1, value-1[, expr-2, value-2 … [, expr-n,value-n]])

ex select Switch([fielda]="1","one",[fielda]="2","two"",[fielda]>"2","other") AS myfield , FROM tablea

The problem with the switch statement is that the function returns a null if none of the conditions are found.  And sometimes it is difficult to have an other statement in this case use the iif and the switch together

SELECT iif(Switch([fielda]="1","one",[fielda]="2","two") is not null,Switch([fielda]="1","one",[fielda]="2","two"),"BLANKS" )AS myfield FROM tablea


Author Comment

ID: 6843085
hi raama16, If what you said true, i will not waste more time on this. Thank you. =)

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 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