J
John
Hello.
I'm creating a report in Access 2007, and I'd like to have alternating
colours. The challenge is that the actual option for alternating
colours seems to only apply to the detail records, but I want each
group to have alternating colours, and the groups can have a varying
number of detail records. I have managed this before in Access 2003,
but for some reason it's not working in 2007. My logic is pretty
simple:
1) I have a counter variable that counts the number of groups - it
gets initialized to 0 when the report opens.
2) When a Group Header is formatted, it checks to see if the counter
is divisible (evenly) by 2. If it is, it sets the group header back
colour to light blue. If not, it sets it to white.
3) On detail format, it sets the detail back colour to whatever the
back colour of the group header is.
4) On group footer format, it sets the group footer back colour to
whatever the back colour of the group header is, and then increments
the counter by 1.
Now here's the strange thing: according to what I have displaying in
the debug window, it's actually setting the colours properly. The
problem is that it's not displaying the report showing the colours
that it set. This is what displays in the debug window:
Group: 1 Event: HEADER FORMAT Header Color: 16180438 Detail
Color: 16777215 Footer Color: 16777215
Group: 1 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 1 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 1 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 1 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 1 Event: FOOTER FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16180438 <--
Group: 2 Event: HEADER FORMAT Header Color: 16777215 Detail
Color: 16180438 Footer Color: 16180438
Group: 2 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 2 Event: FOOTER FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16777215 <--
Group: 3 Event: HEADER FORMAT Header Color: 16180438 Detail
Color: 16777215 Footer Color: 16777215
Group: 3 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 3 Event: FOOTER FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16180438 <--
Group: 4 Event: HEADER FORMAT Header Color: 16777215 Detail
Color: 16180438 Footer Color: 16180438
Group: 4 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 4 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 4 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 4 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 4 Event: FOOTER FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16777215 <--
Group: 5 Event: HEADER FORMAT Header Color: 16180438 Detail
Color: 16777215 Footer Color: 16777215
Group: 5 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 5 Event: FOOTER FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16180438 <--
Group: 6 Event: HEADER FORMAT Header Color: 16777215 Detail
Color: 16180438 Footer Color: 16180438
Group: 6 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 6 Event: FOOTER FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16777215 <--
Note that after every Footer Format event, all of the colours match,
as they should. (On a side note, there are actually only 3 groups
displaying on the report - for some reason, Access is formatting the
report twice.) I can't really post a picture of what's actually being
displayed, so hopefully this makes sense:
Header 1: (not displayed because the height is 0)
Detail 1a: white
Detail 1b: white
Detail 1c: white
Detail 1d: white
Footer 1: white
Header 2: (not displayed)
Detail 2a: light blue
Footer 2: white
Header 3: (not displayed)
Detail 3a: white
Footer 3: white
This is turning into a lengthy message. Hopefully it made some sense.
I'm thinking there's probably something really simple that I'm
missing, but I've been staring at it and trying things for several
hours with no luck.
Thanks for any help.
John
I'm creating a report in Access 2007, and I'd like to have alternating
colours. The challenge is that the actual option for alternating
colours seems to only apply to the detail records, but I want each
group to have alternating colours, and the groups can have a varying
number of detail records. I have managed this before in Access 2003,
but for some reason it's not working in 2007. My logic is pretty
simple:
1) I have a counter variable that counts the number of groups - it
gets initialized to 0 when the report opens.
2) When a Group Header is formatted, it checks to see if the counter
is divisible (evenly) by 2. If it is, it sets the group header back
colour to light blue. If not, it sets it to white.
3) On detail format, it sets the detail back colour to whatever the
back colour of the group header is.
4) On group footer format, it sets the group footer back colour to
whatever the back colour of the group header is, and then increments
the counter by 1.
Now here's the strange thing: according to what I have displaying in
the debug window, it's actually setting the colours properly. The
problem is that it's not displaying the report showing the colours
that it set. This is what displays in the debug window:
Group: 1 Event: HEADER FORMAT Header Color: 16180438 Detail
Color: 16777215 Footer Color: 16777215
Group: 1 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 1 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 1 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 1 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 1 Event: FOOTER FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16180438 <--
Group: 2 Event: HEADER FORMAT Header Color: 16777215 Detail
Color: 16180438 Footer Color: 16180438
Group: 2 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 2 Event: FOOTER FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16777215 <--
Group: 3 Event: HEADER FORMAT Header Color: 16180438 Detail
Color: 16777215 Footer Color: 16777215
Group: 3 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 3 Event: FOOTER FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16180438 <--
Group: 4 Event: HEADER FORMAT Header Color: 16777215 Detail
Color: 16180438 Footer Color: 16180438
Group: 4 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 4 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 4 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 4 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 4 Event: FOOTER FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16777215 <--
Group: 5 Event: HEADER FORMAT Header Color: 16180438 Detail
Color: 16777215 Footer Color: 16777215
Group: 5 Event: DETAIL FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16777215
Group: 5 Event: FOOTER FORMAT Header Color: 16180438 Detail
Color: 16180438 Footer Color: 16180438 <--
Group: 6 Event: HEADER FORMAT Header Color: 16777215 Detail
Color: 16180438 Footer Color: 16180438
Group: 6 Event: DETAIL FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16180438
Group: 6 Event: FOOTER FORMAT Header Color: 16777215 Detail
Color: 16777215 Footer Color: 16777215 <--
Note that after every Footer Format event, all of the colours match,
as they should. (On a side note, there are actually only 3 groups
displaying on the report - for some reason, Access is formatting the
report twice.) I can't really post a picture of what's actually being
displayed, so hopefully this makes sense:
Header 1: (not displayed because the height is 0)
Detail 1a: white
Detail 1b: white
Detail 1c: white
Detail 1d: white
Footer 1: white
Header 2: (not displayed)
Detail 2a: light blue
Footer 2: white
Header 3: (not displayed)
Detail 3a: white
Footer 3: white
This is turning into a lengthy message. Hopefully it made some sense.
I'm thinking there's probably something really simple that I'm
missing, but I've been staring at it and trying things for several
hours with no luck.
Thanks for any help.
John