Solved

every second line in a report with grey background

Posted on 2000-02-25
2
292 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
2 Comments
 
LVL 9

Accepted Solution

by:
BrianWren earned 50 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 57
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

840 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