If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Color code Headers
I have a report that requires headers each with a different color. I have
gone to the property of the text box and can change all Headers to one color. Is there a way to have every 4th header a different color and then repeat the cycle? -- Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
Color code Headers
Add a text box to the header, and give it these properties:
Control Source =1 Running Sum Over All Name txtHeaderCount Format General Number Visible No You can now use: ([txtHeaderCount] -1) Mod 4 which returns 0,1,2,3 repeating, so you can set your color by that value. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Datacruz via AccessMonster.com" u56258@uwe wrote in message news:a0dbb3fe9e398@uwe... I have a report that requires headers each with a different color. I have gone to the property of the text box and can change all Headers to one color. Is there a way to have every 4th header a different color and then repeat the cycle? -- Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
Color code Headers
Datacruz via AccessMonster.com wrote:
I have a report that requires headers each with a different color. I have gone to the property of the text box and can change all Headers to one color. Is there a way to have every 4th header a different color and then repeat the cycle? I wonder which header you want to do this? Assuming it's a group header, add a (hidden) text box (named txtHdrCount) to the header section, Set its control source expression to =1 and RunningSum property to Over All. Then you can use some VBA code in the section's Format (or Print) event procedure to set the colors: Select Case txtHdrCount Mod 4 Case 0 'pale blue Me.[group header name].BackColor = RGB(220,220,255) Case 1 'pink Me.[group header name].BackColor = RGB(255,192.192) Case 1 'pale green Me.[group header name].BackColor = RGB(220,255,220) Case 1 'pale yellow Me.[group header name].BackColor = RGB(255,255,220) End Select -- Marsh MVP [MS Access] |
#4
|
|||
|
|||
Color code Headers
Presumably the last two were Case 2 and Case 3
-- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Marshall Barton" wrote in message ... Datacruz via AccessMonster.com wrote: I have a report that requires headers each with a different color. I have gone to the property of the text box and can change all Headers to one color. Is there a way to have every 4th header a different color and then repeat the cycle? I wonder which header you want to do this? Assuming it's a group header, add a (hidden) text box (named txtHdrCount) to the header section, Set its control source expression to =1 and RunningSum property to Over All. Then you can use some VBA code in the section's Format (or Print) event procedure to set the colors: Select Case txtHdrCount Mod 4 Case 0 'pale blue Me.[group header name].BackColor = RGB(220,220,255) Case 1 'pink Me.[group header name].BackColor = RGB(255,192.192) Case 1 'pale green Me.[group header name].BackColor = RGB(220,255,220) Case 1 'pale yellow Me.[group header name].BackColor = RGB(255,255,220) End Select -- Marsh MVP [MS Access] |
#5
|
|||
|
|||
Color code Headers
Allen Browne wrote:
Presumably the last two were Case 2 and Case 3 Right! Thanks for catching that Allen. -- Marsh MVP [MS Access] |
#6
|
|||
|
|||
Color code Headers
Sorry for the delay in thanking you for the code it works great!
Marshall Barton wrote: Presumably the last two were Case 2 and Case 3 Right! Thanks for catching that Allen. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ports/200912/1 |
Thread Tools | |
Display Modes | |
|
|