Shading every other group

M

mmohon

I've seen examples on how to shade every other detail, I was wondering
if there is an easy way to shade every other group.

Just note: I'm not great with VB, so if thats the route I have to take,
please be very specific and dumb it down for me.
 
A

Allen Browne

Here's a solution that requires no code.

1. Add a text box to your group header, and give it these properties:
Name txtHeadCount
Control Source =1
Running Sum Over Group
Format General Number
Visible No

2. Add a text box to the Detail section.
Size it to cover the entire Detail section, and Send To Back.
Choose Conditional Formatting on the Format menu.
Set Condition 1 to:
Expression ... [txtProductCount] Mod 2=0
and choose the shading color you want from the bucket.

3. Set the BackStyle of the other text boxes in the detail section to
Transparent.

How it works
The running-sum text box accumulates 1 each time there is a new header. The
Mod operator tests the left over when you divide by 2. The remainder will be
0 every second time, so the big text box behind everything else in the
detail section is shaded every 2nd group.
 
A

Allen Browne

Correction: The Expression in step 2 has to use the same name as the text
box in step 1, i.e.:
[txtHeadCount] Mod 2 = 0

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

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

Allen Browne said:
Here's a solution that requires no code.

1. Add a text box to your group header, and give it these properties:
Name txtHeadCount
Control Source =1
Running Sum Over Group
Format General Number
Visible No

2. Add a text box to the Detail section.
Size it to cover the entire Detail section, and Send To Back.
Choose Conditional Formatting on the Format menu.
Set Condition 1 to:
Expression ... [txtProductCount] Mod 2=0
and choose the shading color you want from the bucket.

3. Set the BackStyle of the other text boxes in the detail section to
Transparent.

How it works
The running-sum text box accumulates 1 each time there is a new header.
The Mod operator tests the left over when you divide by 2. The remainder
will be 0 every second time, so the big text box behind everything else in
the detail section is shaded every 2nd group.

I've seen examples on how to shade every other detail, I was wondering
if there is an easy way to shade every other group.

Just note: I'm not great with VB, so if thats the route I have to take,
please be very specific and dumb it down for me.
 

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