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

Alternating SHADED Lines on ACCESS REPORT 3

Status
Not open for further replies.

kjenkinz

Technical User
Jan 24, 2003
16
US
I saw a post which provided the code that would alternate shaded lines in an MS Access Report. I can no longer find it. Anyone? This has been a very useful formating tool when preparing 100 page financial reports!
 
Don't know about the previous post but here's how I'd do it. Pop this VBA in your report:

Code:
Dim booLine As Boolean 'Define boolean variable availble throughout report

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If booLine Then
    Detail.BackColor = 12632256 'Grey
Else
    Detail.BackColor = 16777215 'White
End If
booLine = Not booLine 'Toggle booLine ready for next line
End Sub

Don't forget to select [Event procedure] in the Detail section's OnFormat event. [pc2]
 
For mp9's code to work you will have to change one line.

Dim booline as Boolean
needs to be
Static booline as Boolean

Otherwise the boolean never switches value.

Paul
 
A somewhat less demanding approach, if -perhaps- not as logical?

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

Of course selection of the value for "XorToggle" does need to be considered.

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
mp9, interesting. I tested it and got all white backcolor. I switched it to Static and it alternated fine. I agree that Michael's is succinct.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top