?
Solved

every second line in a report with grey background

Posted on 2000-02-25
2
Medium Priority
?
319 Views
Last Modified: 2012-08-13
I do have a report with a lot of data. To get a proper view on this, I would like to have every second line with a grey background. How to do??
0
Comment
Question by:Kongta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
BrianWren earned 150 total points
ID: 2559648
Set up a global variable in a module that will be toggled on and off, Say:

Public rptBkGnd As Boolean

In the report detail On Format Event put:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

     Select Case rptBkGnd
          Case True
               Me.Section(0).BackColor = 16777215 ' White
               rptBkGnd = False
          Case False
               Me.Section(0).BackColor = 12632256 ' Gray
               rptBkGnd = True
     End Case

End Sub

Brian
0
 
LVL 58
ID: 2559759
Just one additonal note to Brian's suggestion.  OnFormat can get fired off multiple times if Access retreats up the page, so wrap the code he gave you in a check like this:


  If FormatCount = 1 then
   'Brian's code here
  End If

  This way, your background color will only toggle once.

Jim
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

762 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