Alternating Line Colors

B

Burt

Hi,

I am creating an adp program. I am looking for a way to
alternate colors in a datasheet view of a table.
Specifically, have one line light yellow, the next white,
then light yellow again.

I know how to do this within an mdb database, however,
when I transafered the code into the adp project all I got
was all yellow lines.

If possible please advise.

Thanks in advance for any help or direction,

Burt
 
A

Arvin Meyer

I've been using this one for about 10 years now:

Declare two constants in the declarations section of your report module:

Const GREY = 12632256
Const WHITE = 16777215

Then in the detail section, put the following code. in this example the only
fields are phone and name, but in your report you need to specify all the
fields and change their back color property.

Sub Detail1_Print (Cancel As Integer, PrintCount As Integer)
Static ShadeOnOff As Integer

If ShadeOnOff = True Then
Me.section(0).backcolor = GREY
Me![phone].backcolor = GREY
Me![name].backcolor = GREY

Else
Me.section(0).backcolor = WHITE
Me![phone].backcolor = WHITE
Me![name].backcolor = WHITE
End If

ShadeOnOff = Not ShadeOnOff

End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Top