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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shading report sections 1

Status
Not open for further replies.

dixxy

Technical User
Mar 4, 2003
220
CA
Hello,

i would like to know if there is a way to shade alternate line in a report section other than the detail section.

I have the following code that will do just that , but only in the 'Details' section. My report has several groups which I would like to shade on of them.

This is the code I have but doesm't work for sections:

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Const vbLightGrey = 14540253

    If Me.CurrentRecord Mod 2 = 0 Then

      Me.Section(acDetail).BackColor = vbLightGrey

   Else

      Me.Section(acDetail).BackColor = vbWhite

   End If
End Sub
 
You should be able to use similar code in the On Format event of the Group Section. Your code "Me.CurrentRecord Mod 2 = 0" would be replace by some expression that identifies the one section you want to shade.

Duane
MS Access MVP
 
ok, but what expression? I have tried different one with no luck..:-( I would like GroupHeader5 to be shaded..

 
If it is always shaded, then set this while in design view. If you want it shaded only for specific conditions then we need to know those conditions.

Duane
MS Access MVP
 
All I want is to alternate on each record. So one white, one shaded, one white, one shaded, etc...
 
You can create a text box in the Group Header:
Name: txtCountGroup
Control Source: =1
Running Sum: Over All

Then use code like:
Const vbLightGrey = 14540253
If Me.txtCountGroup Mod 2 = 0 Then
Me.Section("GroupHeader5").BackColor = vbLightGrey
Else
Me.Section("GroupHeader5").BackColor = vbWhite
End If


Duane
MS Access MVP
 
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    'Michael Red.   2/13/2002.      To 'Toggle the backolor, which
    'Provides alternate line shading
    Const XorToggle = 4144959

    Me.Detail.BackColor = Me.Detail.BackColor Xor XorToggle
End Sub

I must admit to some confusion in what -exactly- you are attempting. It "looks Like" to me that you want to do the alternate shading bit in each of several "groups"?

If so there are really two questions here:
how to do the alternate shading (which you have AN answer - but it is not necessarily the 'better soloution. So see the code block above;

were to place the code to have it be effective across the different groups - it is placed in the Detail_Format procedure. Once, and ONLY once. You must, of course, set the background of all of th controls in the detail section to transparent to achieve the usually desired effect.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top