[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MS Access Reports GreenBar or Muliptile color lines

Posted on 2007-08-02
4
Medium Priority
?
422 Views
Last Modified: 2008-02-01
IN my report, I hide the details, but summarized the group results. I'm trying to create a greenbar affect where each other line has a different color. I found this code and tried it, it's not working correctly.

Private Sub GroupFooter1_Print(Cancel As Integer, PrintCount As Integer)
Dim intCounter As Integer

intCounter = intCounter + 1
If intCounter Mod 2 = 0 Then
    Me.Section(0).BackColor = "16777215"
Else
    Me.Section(0).BackColor = "8454143"

End If

End Sub
0
Comment
Question by:jumpy262000
  • 2
4 Comments
 
LVL 75
ID: 19618993
Lebans has it:

http://www.lebans.com/Report.htm

One of the apps ..

mx
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 19619090
jumpy262000,

you need to create a control name txtLineNum with it's
source =-1, Running Sum - Overall.
visible=NO

If (Me![txtLineNum] Mod 2) = 0 Then

    Me.Section(0).BackColor = "16777215"
Else
    Me.Section(0).BackColor = "8454143"

End If
0
 
LVL 75
ID: 19619181
For your original code, try using the Format event instead.

mx
0
 
LVL 11

Expert Comment

by:LambertHeenan
ID: 19620694
You don't even need the running sum control on the report. All you really need is a static Boolean variable in the Detail section's Format Event...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Static bShaded As Boolean
    If Detail.HasContinued = False Then bShaded = Not bShaded
    If bShaded = False Then
        Me.Detail.BackColor = BGLightGray
    Else
        Me.Detail.BackColor = BGwhite
    End If
End Sub

the line "    If Detail.HasContinued = False Then bShaded = Not bShaded" ensures that if a row of data spans two pages, each part will have the same colors.

BGLightGray and BGwhite are just two constants declared elsewhere that define the colors to use.

HTH

Lambert
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question