Multiple Control Source Report

Tumoz

Board Regular
Joined
Mar 9, 2015
Messages
68
How do i write a story using my table data? Can i do all this with using only 1 Label box?

My table is similar->

NameDogCatPetTotal
Henry11
John11
Paula11

<tbody>
</tbody>

Solution:
Meet Henry, John and Paula. From these people 1 has a dog, and 2 has cat. Total pet amount is 3.

Meet ([Name]). From these people ([Dog]) has a dog, and ([Cat]) has cat. Total pet amount is =Sum([PetTotal]).
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Is it possible to make two "=Sum" expressions in one Control Source? Like

=Sum([CountOfDog]) & ", and" & =Sum([CountOfCat]) & " has cat." Total pet amount is =Sum([CountOfPetTotal])

Help me fix this expression. :(
 
Upvote 0
How do i write a story using my table data? Can i do all this with using only 1 Label box?
Yes, but you will need to loop through all of the records and concatenate the names, separated by commas, to get the first part. Problem is, you'd need more logic to address all of the possibilities. With only 2 fields, the possibilities I see are 3 (someone could have a dog AND a cat). With 4, 15 - so you may have a problem there. Then there is grammar. If you're going to be concerned about that, it's 1 has a dog [singular], 2 have cats [plural].

Is it possible to make two "=Sum" expressions in one Control Source?
If [CountOfDog] is a count, you don't need to use an aggregate function on it. In your example, you are not summing anything. It would be = [CountOfDog] & " has a dog and " & [CountOfCat] & " has a cat " plus whatever else (like " and " & [CountOfBoth] & " have both.").
 
Last edited:
Upvote 0
If "Query Desing View" has more than 1 row of data, [CountOf] for some reason chooses only the first row, it does not sum values.
Example if "Paula" would have cat and dog, report tells me total dog value is 1, when in reality it is 2.

Any way to fix this? :/
 
Upvote 0
Cannot help you with the limited information you supply. What is [CountOf]? It looks like a value or field reference. I still see nothing that indicates you are "summing" anything. Count is not Sum (not that I can see where you're counting anything either). Perhaps if you posted the sql statement...
 
Upvote 0

Forum statistics

Threads
1,221,829
Messages
6,162,229
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top