Make every other line color

T

tjsmags

How do I make every other line on a FORM or REPORT a color so that it's
easier to read when you have a long list? In Excel I do a CONDITIONAL FORMAT
that states:

=MOD(ROW(),2)+1<=1

Can I do this in Access?
 
J

Jeff Boyce

Access 2007 offers this feature. To do it in earlier versions, you might
need to check to see if S. Lebans has something like that at his website...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Gina Whipp

In a report I use...

Option Compare Database
Option Explicit
Dim bluebar As Boolean

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If bluebar Then
Detail.BackColor = 16777215
Else
Detail.BackColor = 15986411
End If
bluebar = Not (bluebar)
End Sub

Never bothered in a form...
 
T

tjsmags

What is his website?

Jeff Boyce said:
Access 2007 offers this feature. To do it in earlier versions, you might
need to check to see if S. Lebans has something like that at his website...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
T

tjsmags

I am a little new to this. I have my report open with the REPORT properties
showing. Where do I find Option Compare Database? I'm sorry I need explicit
directions. Thanks.
 
M

Michael Gramelspacher

I am a little new to this. I have my report open with the REPORT properties
showing. Where do I find Option Compare Database? I'm sorry I need explicit
directions. Thanks.
'This is the On Format event of my reports Detail section.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

On Error Resume Next

Const cYellow As Long = 15198183
Const cwhite As Long = 16777215
Const cPurple As Long = 16751052

Dim ctl As Control
Dim sec As Section
Set sec = Me.Section("Detail")

If sec.BackColor = cwhite Then
sec.BackColor = cYellow
Else
sec.BackColor = cwhite
End If

For Each ctl In sec.Controls
If ctl.BackColor = cYellow Then
ctl.BackColor = cwhite
Else
ctl.BackColor = cYellow
End If
Next

End Sub
 
G

Gina Whipp

Open your report in design mode by highlighting your report (while closed)
in the design window and presing the 'Code' button on the toolbar. Then
copy and paste the entire section I typed, makre you don't get any foreign
characters. Save and close
 
G

Gina Whipp

The height of the shaded area is based on the height of the detail section.
If you want it to shrink and grow according to how much text is there.
Report in design view, click on the Details section.... In the Properties
section of the Detail section set the Can Grow = Yes and Can Shrink = Yes
 
Top