Shading in Reports

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

Guest

Is there any way to format alternate shading of fields in large reports to
make it easier to read? (something like greenbar paper in mainframe reports)
Thanks for your help
 
Hi,

Here is a past post of mine on this subject which should help:
I know of a couple of ways to do this. I use one or the other
method depending upon the need.

First Way: Full Detail Section colored
(Learned from FredG I think)
Watch out for possible line wrapping here!

1. Code the Detail part of your report like this:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Section(0).BackColor = vbWhite Then
Me.Section(0).BackColor = 15724527
Else
Me.Section(0).BackColor = vbWhite
End If
End Sub

2. Now Code the Page Header part of your report like this
to start a new page with white (I think that's correct).

Private Sub PageHeader_Format(Cancel As Integer, FormatCount As Integer)
Me.Detail.BackColor = 16777215
End Sub

By the way, the color grey I have listed there is a real
light grey. Change to whatever you like.
What this will do is fill the entire detail section with
alternating color. This works fine on some reports, but
for other reports where I have a very small detail section
width-wise it's a little much. So I use a different approach.

Second Way: Small Width Detail section

1. Use the rectangle tool to create a box in your detail
section. Set the following properties for it:
--Name BoxShade
--Visible No
--Back Style Normal
--Back Color 15724527
--Special Effect Flat
--Border Style Transparent

2. Now resize the box to just cover the area of detail you
want to have colored.

3. No go up to to the Format menu and select "Send To
Back". This will put the box behind the other controls in
the Detail section.

4. I usually have an option control on a form that has two
options: "No Shading" and "Shade Every Other Line". I have the
default as No Shading (0 in the option group). I then code
the detail section of the report like this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [Forms]![frmNameOfMyForm]![ShadeOption] = 1 Then
If Me.boxShade.Visible = False Then
Me.boxShade.Visible = True
Else
Me.boxShade.Visible = False
End If
Else
Me.boxShade.Visible = False
End If
End Sub

The shading will now appear on every other row, but just
where I want it to shade. By the way, I still use the
option control on the form for the first example above,
but didn't include the code. You should be able to see how
to code it either with an option control on a form or
without by following the two examples.
Hope that gives you some ideas,
 
jimo said:
Is there any way to format alternate shading of fields in large reports to
make it easier to read? (something like greenbar paper in mainframe
reports)

The following Knowledge Base articles describe a technique for shading
alternate lines. By using different calculations, you could shade/unshade
groups of multiple lines... I remember greenbar with two or three lines
green alternating with a similar number of white, as well as alternate
individual lines:

http://support.microsoft.com/default.aspx?scid=kb;en-us;114086

http://support.microsoft.com/default.aspx?scid=kb;en-us;210392

http://support.microsoft.com/default.aspx?scid=kb;en-us;288154

The FAQ at http://www.mvps.org/access/netiquette.htm offers suggestions on
researching issues of this kind so you don't have to wait for someone to
answer a newsgroup post. We don't mind answering the posts, but sometimes
that can get you an answer sooner.

Larry Linson
Microsoft Access MVP
 
Back
Top