Print report every other line

  • Thread starter Thread starter Pedro
  • Start date Start date
P

Pedro

Hi everyone

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

Tks in advance
Pedro
 
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.
 
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
 
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.
 
Thanks! I am new to this message board, but it's the only
way I can get any help or support. I almost didn't reply,
fearing I just couldn't understand the code. I'm so glad I
did - and thanks for the correction. It works!

So far, this message board is fantastic. I can't thank
you enough. I only hope someday I can provide answers for
someone.
Sara
 
sara said:
Thanks! I am new to this message board, but it's the only
way I can get any help or support. I almost didn't reply,
fearing I just couldn't understand the code. I'm so glad I
did - and thanks for the correction. It works!

So far, this message board is fantastic. I can't thank
you enough. I only hope someday I can provide answers for
someone.
Sara

I'm glad I could be of help. Thanx for the feedback.

You don't have to return the favor ... just do a favor for somebody else. It
will eventually make its way back to me. <g>
 
Back
Top