Print report every other line

P

Pedro

Hi everyone

Can i print my report, wich has several lines, with
background color every other line?

Tks in advance
Pedro
 
M

MyndPhlyp

Pedro said:
Hi everyone

Can i print my report, wich has several lines, with
background color every other line?

Tks in advance
Pedro

Seems I've seen this question at least 2 or 3 times this month.

Try this ...

* Make sure your Detail section has its BackStyle property set to
Transparent.

* Do a View => Code and add the global declaration

DIM blnShade As Boolean

* In the Detail section Properties, locate the OnPrint event and click the
"..." selecting Code from the submenu. Add the following code for the
OnPrint event:

Private Sub Detail1_Print(Cancel As Integer, PrintCount As Integer)

Const intColorGray = 14540253
If blnShade Then
Me!Detail1.BackColor = intColorGray
Else
Me!Detail1.BackColor = vbWhite
End If
blnColorGray = Not blnColorGray

End Sub

* Compile and go.
 
S

sara

I tried this and didn't get the shading. Here's my code:
(I changed Me!Detail1 to Detail1 and tried Detail and
Detail0, and still don't get the shading. I don't know
what Me! means).

Dim blnShade As Boolean

Private Sub Detail0_Print(Cancel As Integer, PrintCount As
Integer)

Const intColorGray = 14540253
If blnShade Then
Detail0.BackColor = intColorGray
Else
Detail0.BackColor = vbWhite
End If
blnColorGray = Not blnColorGray

End Sub

I am using Access2000. I want to install on an Access97
database, if it will work.

Thanks,
Sara
 
M

MyndPhlyp

sara said:
I tried this and didn't get the shading. Here's my code:
(I changed Me!Detail1 to Detail1 and tried Detail and
Detail0, and still don't get the shading. I don't know
what Me! means).

Dim blnShade As Boolean

Private Sub Detail0_Print(Cancel As Integer, PrintCount As
Integer)

Const intColorGray = 14540253
If blnShade Then
Detail0.BackColor = intColorGray
Else
Detail0.BackColor = vbWhite
End If
blnColorGray = Not blnColorGray

End Sub

I am using Access2000. I want to install on an Access97
database, if it will work.

Mia culpa. Premature typulation on my part.

Using a fairly default report "right out of the box" (ala Wizard), and
adding the enhancement, here's the corrected code example:

Dim blnShade As Boolean

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Const lngGray = 14540253
If blnShade Then
Me.Detail.BackColor = lngGray
Else
Me.Detail.BackColor = vbWhite
End If
blnShade = Not blnShade
End Sub


The Access-generated Sub name you get when you attach code to the OnPrint
event for the Detail section is your clue. This does work on Access 2000.
I'm not sure about Access 97, but I suspect it will work there, too.
 
Top