A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Color code Headers



 
 
Thread Tools Display Modes
  #1  
Old December 20th, 2009, 06:52 AM posted to microsoft.public.access.reports
Datacruz via AccessMonster.com
external usenet poster
 
Posts: 4
Default 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  
Old December 20th, 2009, 02:51 PM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default 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  
Old December 20th, 2009, 03:21 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default 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  
Old December 21st, 2009, 01:53 AM posted to microsoft.public.access.reports
Allen Browne
external usenet poster
 
Posts: 11,706
Default 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  
Old December 21st, 2009, 03:32 AM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default 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  
Old December 24th, 2009, 08:34 PM posted to microsoft.public.access.reports
Datacruz via AccessMonster.com
external usenet poster
 
Posts: 4
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.