Need help with color printing - please!

  • Thread starter Thread starter a24t42
  • Start date Start date
A

a24t42

I am trying to get some color printing into a report and am having
some problems getting it set up correctly. Here is the problem -

I have 2 fields on a report -

1. An index - with numbers 0 to 4
2. Card Number

What I want to do is depending on what the index is, I want to print
the corresponding card number in a color. For example -

index 0, card number prints black
index 1, card number prints red
index 2, card number prints black
index 3, card number prints blue
index 4, card number prints green

I wrote the following code -

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

If [index] = "1" Then
Reports!rptProduction_All!Date.FontWeight = 700
Reports!rptProduction_All!Date.ForeColor = 255
ElseIf [index] = "3" Then
Reports!rptProduction_All!Date.FontWeight = 700
Reports!rptProduction_All!Date.ForeColor = 10158080
ElseIf [index] = "4" Then
Reports!rptProduction_All!Date.FontWeight = 700
Reports!rptProduction_All!Date.ForeColor = 39680
ElseIf [index] = "2" Then
Reports!rptProduction_All!Date.FontWeight = 400
Reports!rptProduction_All!Date.ForeColor = 0
End If

End Sub

which I attached to the On Print event on the Detail report. The
printer just hangs and I get an error.

Any suggestions or help would be most appreciated. Thanks in advance.
 
Try putting you code in the OnFormat event of the details section.

Although it would seem that it should produce the desired result when
actually sent to the printer, if you want to see the results of the
formatting you are trying to apply, you will need to use the OnFormat event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top