Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Calculating sum of 2 textboxes on report Expand / Collapse
Author
Message
Posted Tuesday, April 7, 2009 6:03 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, August 11, 2009 3:56 AM
Points: 24, Visits: 34
Hi,

I have 2 textboxes on my report (for example textbox1 and textbox2.)

Both textboxes are using IIF statements to return a sum of values and the number is displayed as the result in these 2 textboxes.

Now I have a 3rd textbox called textbox3.

I want to do a sum of textbox1 + textbox2 and display the result in textbox 3.

So textbox 3's expression will look something like this:-

Sum((textbox1.Value)+(textbox2.Value))

How can I do this?
Post #691876
Posted Tuesday, April 7, 2009 9:33 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 10:57 AM
Points: 10,387, Visits: 13,454
You need to use the ReportItems collection like this:

=ReportItems.textbox1.Value + ReportItems.textbox2.Value





Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #692186
Posted Tuesday, April 7, 2009 9:41 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, August 11, 2009 3:56 AM
Points: 24, Visits: 34
I am getting an error with that:-

The value expression for the textbox3 contains an error[BC30456] "textbox1" is not a member of Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItems
Post #692202
Posted Tuesday, April 7, 2009 9:47 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 10:57 AM
Points: 10,387, Visits: 13,454
Then your textbox is not named textbox1. Check to see what it is named.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #692213
Posted Tuesday, April 7, 2009 9:54 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, August 11, 2009 3:56 AM
Points: 24, Visits: 34
I have re-named them but it's coming up with the exact same error message. Just with the names changed.

My first textbox is now called 'self1'. The second one is called 'self2'.

the third one displaying the result is called 'result'.

I noticed after my textbox name in my expression 'value' was not an option in the drop down list brought up by intellisense.

This is my expression:-

=ReportItems.self1.Value + ReportItems.self2.Value

There is a red line under the first ReportItems saying wrong number of arguments
Post #692228
Posted Tuesday, April 7, 2009 10:02 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 10:57 AM
Points: 10,387, Visits: 13,454
Sorry, my bad. It's not:

=ReportItems.textbox1.Value + ReportItems.textbox2.Value

it is:

=ReportItems!textbox1.Value + ReportItems!textbox2.Value

Replace the period after ReportItems with an "!". I always do that




Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #692246
Posted Tuesday, April 7, 2009 10:04 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, August 11, 2009 3:56 AM
Points: 24, Visits: 34
That worked, thanks for all your help with this.
Post #692249
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse