1. Registered User
Join Date
Dec 2003
Location
York PA
Posts
11

I have a report where I need to total several values from the report into another text box within the report. If the inititial text box values would be 3 and 6, instead of coming up with 9, I get 36. I have tried writing the control both as =[textbox1]+[textbox2] and as =(control from textbox1)+(control from textbox2) and I get the same result. I've also inserted ! and . in appropriate locations with no change.
Aargh!

2. Grand Poobah
Join Date
Sep 2003
Location
MI
Posts
3,713

Originally posted by chipsmith
I have a report where I need to total several values from the report into another text box within the report. If the inititial text box values would be 3 and 6, instead of coming up with 9, I get 36. I have tried writing the control both as =[textbox1]+[textbox2] and as =(control from textbox1)+(control from textbox2) and I get the same result. I've also inserted ! and . in appropriate locations with no change.
Aargh!
Ok... You state that you put the textbox within the report ... WHERE IN THE REPORT? Also where in the report are the textboxes that you're trying to do the addition from? Position and placement are critical in calculations in access reports ... Depending on where the textbox is at will determine the type of result you'll get. Also how many records are you dealing with?

3. Registered User
Join Date
Dec 2003
Location
York PA
Posts
11
All the text boxes are in the detail section. i currently get 160 records from the query the report is based on.

4. Grand Poobah
Join Date
Sep 2003
Location
MI
Posts
3,713
Originally posted by chipsmith
All the text boxes are in the detail section. i currently get 160 records from the query the report is based on.
That being said, why don't you have you calculating textbox point to the fields themselves? Something like:

=[Field1]+[Field2]

Here's the thing: You could go the textbox route but you will need to do the appropriate numeric conversion of the value ...

TextBox3:

=CInt([TextBox1Name]) + CInt([TextBox2Name])

5. Registered User
Join Date
Dec 2003
Location
York PA
Posts
11
The controls for the text boxes I am adding together are all IIf statements, all the info is formatted as currency already. I'll try your second suggestion anyway.
Thanks

6. Grand Poobah
Join Date
Sep 2003
Location
MI
Posts
3,713
Originally posted by chipsmith
The controls for the text boxes I am adding together are all IIf statements, all the info is formatted as currency already. I'll try your second suggestion anyway.
Thanks
Something to remember: Textbox values are TEXT. They are not numeric even if it displays that way ... That is the reason why I made the statement I did ... Don't rely upon Access to do the right thing. It has been known to do squirrely things when math ops are performed on text ...

7. Registered User
Join Date
Dec 2003
Location
York PA
Posts
11
Thanks for your help. It got me looking in the right place. I had to use "CCur" though, not "CInt". Many thanks

8. Grand Poobah
Join Date
Sep 2003
Location
MI
Posts
3,713
Originally posted by chipsmith
Thanks for your help. It got me looking in the right place. I had to use "CCur" though, not "CInt". Many thanks
I used CInt only as an example ... You didn't specify what numeric type you were using ...

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•