Tabular form/report - alternate line colour?

dwilliams

Registered User.
Local time
Today, 09:18
Joined
Jul 29, 2006
Messages
22
Hi,

I am trying to produce either a report or a form that displays records 1 to a line. That bits easy enough using a tabular layout.
I would like to make text boxes that hold the data a differnt colour on each alternate line. So the background colour changes from white, then green, white , green etc.

The amount of lines varies each time I run the query.

Anyone give me a starter on this one please?

Thank you

David Williams
 
Here's code for a report:

Code:
Option Compare Database
Option Explicit

Dim fGray

Sub AlternateGray()
  'Purpose: to create alternating gray & white lines in detail.
  'Call this sub from the Detail_Format event
  Const ColorGray = 12632256
  Const ColorWhite = 16777215
  
  Me.Section(0).BackColor = IIf(fGray, ColorGray, ColorWhite)
  fGray = Not fGray
End Sub

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

Users who are viewing this thread

Back
Top Bottom