2 conditional formatting criteria?

  • Thread starter Thread starter Sue
  • Start date Start date
S

Sue

I have a report that includes both adults (at least 18 years of age) and
non-adults (less than 18 years old). I have a footer that counts the number
of contacts with each individual. I want to use conditional formatting to
highlight when there have been 4 or more contacts with adults AND 16 or more
contacts with the remaining people. How can I achieve this?

Thanks so much!!!
 
Sue said:
I have a report that includes both adults (at least 18 years of age) and
non-adults (less than 18 years old). I have a footer that counts the number
of contacts with each individual. I want to use conditional formatting to
highlight when there have been 4 or more contacts with adults AND 16 or more
contacts with the remaining people.


Depends on where/how you are calculating the counts. If you
use an aggregate function (e.g. =Count(*)) in the person
group header, then you can use a CF expression like:

IIf(([adult] And [txtCount] >=4) OR (Not [adult] And
[txtCount] >=16)
 
You got me started on the right track, I think, but I'm not sure how exactly
to word the expression. I am using the count() function to total the number
of items for each individual. The field is titled SessionDate, and the
expression in the textbox in my section footer is =Count([SessionDate]). Can
you help me to figure out how to include that in the txtCount portion of your
expression?
--
Thanks for your time!


Marshall Barton said:
Sue said:
I have a report that includes both adults (at least 18 years of age) and
non-adults (less than 18 years old). I have a footer that counts the number
of contacts with each individual. I want to use conditional formatting to
highlight when there have been 4 or more contacts with adults AND 16 or more
contacts with the remaining people.


Depends on where/how you are calculating the counts. If you
use an aggregate function (e.g. =Count(*)) in the person
group header, then you can use a CF expression like:

IIf(([adult] And [txtCount] >=4) OR (Not [adult] And
[txtCount] >=16)
 
Sue said:
You got me started on the right track, I think, but I'm not sure how exactly
to word the expression. I am using the count() function to total the number
of items for each individual. The field is titled SessionDate, and the
expression in the textbox in my section footer is =Count([SessionDate]). Can
you help me to figure out how to include that in the txtCount portion of your
expression?


Replace txtCount with the name of your count text box.

Unless you are doing something slightly unusual, =Count(*)
is simpler/faster than counting a field. Also note that I
said to put a count text box in the group *header*. You can
make it invisible if you only want to see your count in the
footer. Using a calculated value before it has been
calculated can be a problem in many situations and Access
versions.
 
Back
Top