Printing each page in a different color

J

Joey123

Hi,

Thanks to inofrmation in this forum I've designed a label report to print an
entire page of labels for each record. What I would like to do now is print
each page in a different color font. Can anyone tell me how I can do this.

Thanks
Joe
 
M

Marshall Barton

Joey123 said:
Thanks to inofrmation in this forum I've designed a label report to print an
entire page of labels for each record. What I would like to do now is print
each page in a different color font. Can anyone tell me how I can do this.


Use the Page Header section's Format or Print event with
code that uses the page number to select the color from a
table. Then set each text box's ForeColor property to the
selected color's RGB value.
 
F

fredg

Hi,

Thanks to inofrmation in this forum I've designed a label report to print an
entire page of labels for each record. What I would like to do now is print
each page in a different color font. Can anyone tell me how I can do this.

Thanks
Joe

How many pages are you talking about?
Let's assume 3 pages, setting the font color to Black, Blue, and
Yellow.

Code the report's Page Header Format property:

Dim c As Control
For Each c In Me.Section(0).Controls
If Me.Page = 1 Then
c.ForeColor = vbBlack
ElseIf Me.Page = 2 Then
c.ForeColor = vbBlue
ElseIf Me.Page = 3 Then
c.ForeColor = vbYellow
End If
Next c
 
J

Joey123

Thanks Fred - this worked perfectly!
[quoted text clipped - 4 lines]
Thanks
Joe

How many pages are you talking about?
Let's assume 3 pages, setting the font color to Black, Blue, and
Yellow.

Code the report's Page Header Format property:

Dim c As Control
For Each c In Me.Section(0).Controls
If Me.Page = 1 Then
c.ForeColor = vbBlack
ElseIf Me.Page = 2 Then
c.ForeColor = vbBlue
ElseIf Me.Page = 3 Then
c.ForeColor = vbYellow
End If
Next c
 
J

Joey123

Is there a way to choose more colors - I need about 20.
[quoted text clipped - 4 lines]
Thanks
Joe

How many pages are you talking about?
Let's assume 3 pages, setting the font color to Black, Blue, and
Yellow.

Code the report's Page Header Format property:

Dim c As Control
For Each c In Me.Section(0).Controls
If Me.Page = 1 Then
c.ForeColor = vbBlack
ElseIf Me.Page = 2 Then
c.ForeColor = vbBlue
ElseIf Me.Page = 3 Then
c.ForeColor = vbYellow
End If
Next c
 
M

Marshall Barton

Joey123 said:
Is there a way to choose more colors - I need about 20.

As I said before, put the color RGB values in a table (named
Colors) with two fields PgNo and ColorCode. Populate the
table with records like:

1 0
2 255
3 16711680
4 65535
. . .

Then Fred's code would look like:

Dim x As Long
Dim c As Control

x = DLookup("ColorCode", "Colors", "PgNo=" & Me.Page)
For Each c In Me.Section(0).Controls
c.ForeColor = x
Next c
 

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

Top