Make every other line color

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
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...
 
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
 
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.
 
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
 
Are you telling me to look at an article? If so, I cannot find the link...
 
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
 
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
 

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

Back
Top