Counting more than one type of entry in same string

  • Thread starter Thread starter pompeyboyUSA
  • Start date Start date
P

pompeyboyUSA

I am trying to count more than one type of entry to be entered into a text box.

For example I need to have a total of all types of Officers (Lt Col, Maj,
Capt, Lt) in one text box and a total count of Other Ranks in a seperate text
box

I can count one type using a text box in the Report Header containig
=Sum(Abs([HeldRank]="Capt")) but I can't seem to work out how to have them
all add up in one string.

Is there also a way to add the two text boxes together once you have the
subtotals

Thank you for your help

Charlie
 
You can string together the different tests:

=Sum(Abs([HeldRank]="Capt" OR [HeldRank]="Lt Col" OR [HeldRank]="Maj"
OR [HeldRank]="Lt")))

And, for the other sum:

=Sum(Abs([HeldRank]<>"Capt" AND [HeldRank]<>"Lt Col" AND [HeldRank]<>"Maj"
AND [HeldRank]<>"Lt")))
 
Ken,

Superb, thank you very much, works a treat.



Ken Snell (MVP) said:
You can string together the different tests:

=Sum(Abs([HeldRank]="Capt" OR [HeldRank]="Lt Col" OR [HeldRank]="Maj"
OR [HeldRank]="Lt")))

And, for the other sum:

=Sum(Abs([HeldRank]<>"Capt" AND [HeldRank]<>"Lt Col" AND [HeldRank]<>"Maj"
AND [HeldRank]<>"Lt")))

--

Ken Snell
<MS ACCESS MVP>


pompeyboyUSA said:
I am trying to count more than one type of entry to be entered into a text
box.

For example I need to have a total of all types of Officers (Lt Col, Maj,
Capt, Lt) in one text box and a total count of Other Ranks in a seperate
text
box

I can count one type using a text box in the Report Header containig
=Sum(Abs([HeldRank]="Capt")) but I can't seem to work out how to have them
all add up in one string.

Is there also a way to add the two text boxes together once you have the
subtotals

Thank you for your help

Charlie
 
Back
Top