Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Background color for Group Header 1

Status
Not open for further replies.

Knicks

Technical User
Apr 1, 2002
383
US
I have this code for changing background color but it only works on the detail section. My reports use a lot of summarizing and I would like to alternate background colors at the Group level. Any help would be appreciated in coding for Access 2000

Const lngColour = 4144959 'i.e. 16777215 (white) - 126322566 (pale grey)
Detail.BackColor = Detail.BackColor Xor lngColour
 
Knicks
Well, here's an approach you could use with the Group Footer, or Header. What I show below is an example for the Group Footer section.

1. Put a small text box in the section (let's call it txtShade). Set its Control Source to =1. Make it a running sum Over Group. Make it invisible.
2. Make sure that the BackStyle for each control in the section is Transparent.
3. On the Format event for the section, put something such as the following...
Code:
Dim intTemp As Integer
intTemp = Me.txtShade Mod 2
If intTemp = 0 Then
Me.GroupFooter0.BackColor = vbRed
Else: Me.GroupFooter0.BackColor = vbBlue
End If

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top