August 17, 2007 at 9:25 am
Hi, is there a way to reference a textbox in an expression for another textbox?
I have manual report values I have to enter into textboxes on my report but I want to have 1 textbox at the bottom that sums them all up. But I'm not able to just say txtbox34.Value + txtbox35.Value ... is there a collection or something I need to use so it knows what I'm talking about?
Thanks,
Roxanne
August 20, 2007 at 7:33 am
Hi Roxanne,
For example, if you have two textboxes with names "mytext1" and "mytext2" and you want to set the value of "mytext2" with the value of "mytext1", into the expression of "mytext2", put the following code:
=ReportItems("mytext1").Value
August 20, 2007 at 7:38 am
Ah thanks! Was missing the reportitem collection.
Another question about this, when I did what you suggested...
=ReportItems!txtbox34.value + ReportItems!txtbox35.value
All it did was concatenate the values... it did not add them together.
How do I get it to sum them instead of concatenating?
August 20, 2007 at 7:44 am
You should make a cast.
Try with this:
=CInt(ReportItems!txtbox34.value) + CInt(ReportItems!txtbox35.value)
CInt converts a string to int. If you want another type of conversion, you should watch at expression properties of the textbox, Common Functions, Conversion.
August 20, 2007 at 8:13 am
Ah, thank you thank you... that did the trick!
August 20, 2007 at 8:43 am
Actually sorry, I have another question about that...
Cint does work...but my numbers are decimals... so its dropping off my decimal values.
EDIT: Nevermind... I found its Val()
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply