Alternate background color

S

SF

Hi,

I have a report that I want to change the background color into 3 alternate
colors eg White, gray and dark gray. How to archeive that?

SF
 
D

Duane Hookom

Try this code in the On Format event of the detail section. Read the
comments regarding the new text box in your detail section

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'this code assumes there is a text box in the detail section
' Name: txtCountSection
' Control Source: =1
' Running Sum: Over Group
' Visible: No (optional)
Select Case Me.txtCountSection Mod 3
Case 1
Me.Detail.BackColor = vbWhite
Case 2
Me.Detail.BackColor = 12632256
Case 0
Me.Detail.BackColor = 8421504
End Select
End Sub
 
M

Marshall Barton

SF said:
I have a report that I want to change the background color into 3 alternate
colors eg White, gray and dark gray. How to archeive that?


Add code to the detail section's Format or Print event
procedure. The general idea is along these lines:

With Me.Section(0)
If .BackColor = vbWhite Then
.BackColor = RGB(230,230,230)
ElseIf .BackColor = RGB(230,230,230) Then
.BackColor = RGB(160,160,160)
Else
.BackColor = vbWhite
End If
End With

To make the first line white, use that report header or a
group header section Format evnt to initialize the color:
Me.Section(0).BackColor = vbRed 'anything other than white
 

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