• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

Dynamically change value in textbox

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"

0
chwankok
Asked:
chwankok
1 Solution
 
Ryan ChongCommented:
What don't you update the DataSource of Data Report??
0
 
Ryan ChongCommented:
> What don't you update ..
"What" should be "Why"
0
 
SirNickCommented:
Hi chwankok
Try

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

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
chwankokAuthor Commented:
SirNick,
It does not work and i tried this too
Me.Sections("section1").Controls.Item("Text1").Text = "Hello"

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

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

regards
0
 
raama16Commented:
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 !!!

Regards,
Ramachandra
0
 
jdesharnaisCommented:
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

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now