November 7, 2007 at 8:54 pm
I have some pretty complex formulae in text boxes. I often find myself repeating these formulae, just to get the value of the text box and use it somewhere else (for instance, in conditional formatting or suppression).
Is it possible to use a reference to the text box instead of duplicating the formula? If so, how? An example would be in a conditional format, where I'd like to say "IIF(textbox12.value < 20, Red, Blue)", for instance. Better still would be something like "IIF(self.value < 20, Red, Blue)". Any suggestions?
November 8, 2007 at 6:28 am
To refer to other report items such as text boxes use...
=ReportItems!textBox1.value
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgNovember 8, 2007 at 2:26 pm
Great, thanks for that.
November 9, 2007 at 8:07 am
Another suggestion would be to push the formula up to the Report Level, then have each of the text boxes reference it there. The code editor is terrible there (why does Microsoft do that?!?), but probably a better, more centralized location.
If you find you're usign the same formula again and again in multiple reports, consider adding an assembly to RS.
November 13, 2007 at 11:24 am
Is there a general way to reference to a textbox without name it? For example, I want to check to see if value of a textbox is positive or nagative, is there a way to just call self.value?
I have to check values for every single textboxes in my report and there are about 100 of them, so I just want to find a better way of doing ReportItems!textbox1.value or ReportItems!textbox2.value. Is there a way to just call ReportItems!self.value?
Thanks so much for your help!
November 13, 2007 at 1:10 pm
I think you are looking for the keyword "Me" (As in "Me.Value"). Don't try to display it in the contents of the text box, because you'll get an error (recurssion error).
Without an understanding of what you'e doing, I'd explore the following possibilities:
- Can you abstract your calculation to a data source. Remember, you can create calculated columns in a data source and simply push your calculation there.
- I'd pass the text box (or value) into the calculation. Something along the lines of:
=code.myColor(me.value)
Good luck.
November 13, 2007 at 2:04 pm
Hi Dave Balsillie,
Thanks for the reply!
What I am try to do is to conditionally format the numbers in my report. I can easily do IIF(ReportItems!textbox100.value <0, "RED","GREEN") in the color property box; However, I have like 100 textboxes like these to do, and it is tedious to go through all of them to fill in the textbox name for each. So I am looking for a way to call the value of the textbox that I am trying to format.
Is there a easier way to check the value of the textbox that I am trying to format instead of going through each single textbox to fill in the same code but different name of that one textbox?
What I am trying to do is copy the same code as IIF(ReportItems!ME.value <0, "RED","GREEN") instead of putting IIF(ReportItems!textbox100.value <0, "RED","GREEN") and change the textbox name for every single textbox and there are 100 of them.
Thanks!
Dave Balsillie (11/13/2007)
I think you are looking for the keyword "Me" (As in "Me.Value"). Don't try to display it in the contents of the text box, because you'll get an error (recurssion error).Without an understanding of what you'e doing, I'd explore the following possibilities:
- Can you abstract your calculation to a data source. Remember, you can create calculated columns in a data source and simply push your calculation there.
- I'd pass the text box (or value) into the calculation. Something along the lines of:
=code.myColor(me.value)
Good luck.
November 13, 2007 at 4:02 pm
try
=IIF(me.value <0, "RED","GREEN")
November 13, 2007 at 5:03 pm
Wow... you are the best... it works perfectly...
Thanks!
Dave Balsillie (11/13/2007)
try=IIF(me.value <0, "RED","GREEN")
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply