Conditional Formating within each group

D

doughnut

I have a list of records divided by gender in report groups (2 groups: female
and mail).
I would like to color in each group the highest and lowest record.

Preferebly using conditional formatting
 
A

Allen Browne

In the Gender Group Header section, add a text box with these properties:
Control Source =Count("*")
Format General Number
Name txtGenderHeadCount
Visible No

In the Detail section add a text box with these properties:
Control Source =1
Running Sum Over Group
Format General Number
Name txtDetailCounter
Visible No

You can now set up the conditional formatting on the box you want, like
this:
Expression ([txtDetailCounter]=1) OR
([txtDetailCounter]=[txtGenderHeadCount])
 
D

doughnut

HI Allen and thanks,

I really did not understand your suggestion.

I would like to have final results lk=ook something like this:

Gender: MALE

Mark1 Mark2
9 (max: Colored) 5
5 8 (max: colored)
3 (min: Colored) 1 (min: colored)


Gender: Female

Mark1 Mark2
8 (max: Colored) 5
5 9 (max: colored)
2 (min: Colored) 1 (min: colored)


I hope this explains more what i was going for.

By the way, both groups should be on the same report.

Allen Browne said:
In the Gender Group Header section, add a text box with these properties:
Control Source =Count("*")
Format General Number
Name txtGenderHeadCount
Visible No

In the Detail section add a text box with these properties:
Control Source =1
Running Sum Over Group
Format General Number
Name txtDetailCounter
Visible No

You can now set up the conditional formatting on the box you want, like
this:
Expression ([txtDetailCounter]=1) OR
([txtDetailCounter]=[txtGenderHeadCount])

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

doughnut said:
I have a list of records divided by gender in report groups (2 groups:
female
and mail).
I would like to color in each group the highest and lowest record.

Preferebly using conditional formatting
 
A

Allen Browne

1. Open the report in design view.

2. Open the Sorting And Grouping box.

3. In Sorting'n'Grouping, select the Gender field.

4. In the lower pane of the dialog, set Group Header to Yes. Access adds a
Gender Group Header to the report design.

5. In the Gender Group Header section, add a text box ...
(as described previously.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

doughnut said:
HI Allen and thanks,

I really did not understand your suggestion.

I would like to have final results lk=ook something like this:

Gender: MALE

Mark1 Mark2
9 (max: Colored) 5
5 8 (max: colored)
3 (min: Colored) 1 (min: colored)


Gender: Female

Mark1 Mark2
8 (max: Colored) 5
5 9 (max: colored)
2 (min: Colored) 1 (min: colored)


I hope this explains more what i was going for.

By the way, both groups should be on the same report.

Allen Browne said:
In the Gender Group Header section, add a text box with these properties:
Control Source =Count("*")
Format General Number
Name txtGenderHeadCount
Visible No

In the Detail section add a text box with these properties:
Control Source =1
Running Sum Over Group
Format General Number
Name txtDetailCounter
Visible No

You can now set up the conditional formatting on the box you want, like
this:
Expression ([txtDetailCounter]=1) OR
([txtDetailCounter]=[txtGenderHeadCount])

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

doughnut said:
I have a list of records divided by gender in report groups (2 groups:
female
and mail).
I would like to color in each group the highest and lowest record.

Preferebly using conditional formatting
 
F

fredg

I have a list of records divided by gender in report groups (2 groups: female
and mail).
I would like to color in each group the highest and lowest record.

Preferebly using conditional formatting

Shouldn't the groups be female and telephone? <g>
What determines what the highest and lowest record in each group is?
Do you wish to 'color' the control or the detail background?
Remember, you can see your database. We can't.
 
D

doughnut

To answer you questions.
1. The details of the report are the marks givven by men and weman to the
feelings towards countries (project for school).
2. the report show the avrage grades givvedn by all men and all weman to
each country.
3. I would like to highlight the text box with the hights and lowenst mark
for each group. total 4 controls.

However, accress finds the lowest and highest of both genders (total of 2
controls) instead of each gender group.
 
D

doughnut

doesn't work.

I'm trying to find the highest value of each group. which is not the last
record

Allen Browne said:
1. Open the report in design view.

2. Open the Sorting And Grouping box.

3. In Sorting'n'Grouping, select the Gender field.

4. In the lower pane of the dialog, set Group Header to Yes. Access adds a
Gender Group Header to the report design.

5. In the Gender Group Header section, add a text box ...
(as described previously.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

doughnut said:
HI Allen and thanks,

I really did not understand your suggestion.

I would like to have final results lk=ook something like this:

Gender: MALE

Mark1 Mark2
9 (max: Colored) 5
5 8 (max: colored)
3 (min: Colored) 1 (min: colored)


Gender: Female

Mark1 Mark2
8 (max: Colored) 5
5 9 (max: colored)
2 (min: Colored) 1 (min: colored)


I hope this explains more what i was going for.

By the way, both groups should be on the same report.

Allen Browne said:
In the Gender Group Header section, add a text box with these properties:
Control Source =Count("*")
Format General Number
Name txtGenderHeadCount
Visible No

In the Detail section add a text box with these properties:
Control Source =1
Running Sum Over Group
Format General Number
Name txtDetailCounter
Visible No

You can now set up the conditional formatting on the box you want, like
this:
Expression ([txtDetailCounter]=1) OR
([txtDetailCounter]=[txtGenderHeadCount])

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

I have a list of records divided by gender in report groups (2 groups:
female
and mail).
I would like to color in each group the highest and lowest record.

Preferebly using conditional formatting
 
F

fredg

To answer you questions.
1. The details of the report are the marks givven by men and weman to the
feelings towards countries (project for school).
2. the report show the avrage grades givvedn by all men and all weman to
each country.
3. I would like to highlight the text box with the hights and lowenst mark
for each group. total 4 controls.

However, accress finds the lowest and highest of both genders (total of 2
controls) instead of each gender group.

You can easily use code in the report's Detail Format event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If ([ANumber] = DMax("[ANumber]", "TableName", "[Gender] = 'Male'")) _
Or ([ANumber] = DMax("[ANumber]", "TableName", "[Gender] = 'Female'"))
_
Or ([ANumber] = DMin("[ANumber]", "TableName", "[Gender] = 'Male'")) _
Or ([ANumber] = DMin("[ANumber]", "TableName", "[Gender] = 'Female'"))
Then
Me.ANumber.BackColor = vbYellow
Else
Me.ANumber.BackColor = vbWhite
End If

End Sub

Change "TableName" to whatever the name of the report's record source
is... a table or a query name".
Change [ANumber] to the name of the field that contains the mark
value.
Change [Gender] to the name of the field that contains whether the
student is Male or Female.
Note: as written above, Gender is a Text datatype field, and it's
value is either "Male" or "Female".
If, in fact it is a Yes/No datatype, where the values are either -1 or
0, then use the following syntax:

([ANumber] = DMax("[ANumber]", "tblBlank", "[Gender] = -1"))
or
([ANumber] = DMax("[ANumber]", "tblBlank", "[Gender] = 0))
etc...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top