PageHeader BackColor changeable by field values?

K

Kenny Markhardt

Currently print a report based on whether a customer exceeds any one of nine
different standards/criteria. A query does the selections and a customer
could be selected on multiple criteria. Each customer may have a series of
detail records (and many pages) and a new page is forced when the customer
changes.
Currently print the reason(s) for selection in the GroupHeader for each
customer, but that can get a little too clogged up if happen to have
multiple reasons. Would like to have the PageHeader BackColor change
depending on the reason the customer was included. Will rank the reasons, so
the most important reason's color will be the one to print.

Have tried dozens of combinations of events and keep getting errors. Below
is a short example.
Is this even possible to do?

Private Sub PageHeader_Print(Cancel As Integer, FormatCount As Integer)

If curAmntDue > 100 Then tried
IIf and also [] around field name
Me!PageHeader.BackColor = 16777164 tried ! and
..(period)
Else
Me!PageHeader.BackColor = 65535
End If

Additional Ifs or maybe use Chose to select more colors here

End Sub
 
W

Wayne Morgan

It would need to be a value that would only change once per page. Place a
textbox in the header and bind it to the field. Set its Visible property to
No. In the header's Format event, write code to change the back color.

Example:
If Me.txtMyTextbox = 3 Then
Me.Section(acPageHeader).BackColor = 255
Else
Me.Section(acPageHeader).BackColor = 26122
End If
 
K

Kenny Markhardt

Works Perfectly.........Thanks



Wayne Morgan said:
It would need to be a value that would only change once per page. Place a
textbox in the header and bind it to the field. Set its Visible property to
No. In the header's Format event, write code to change the back color.

Example:
If Me.txtMyTextbox = 3 Then
Me.Section(acPageHeader).BackColor = 255
Else
Me.Section(acPageHeader).BackColor = 26122
End If

--
Wayne Morgan
Microsoft Access MVP


Kenny Markhardt said:
Currently print a report based on whether a customer exceeds any one of
nine
different standards/criteria. A query does the selections and a customer
could be selected on multiple criteria. Each customer may have a series of
detail records (and many pages) and a new page is forced when the customer
changes.
Currently print the reason(s) for selection in the GroupHeader for each
customer, but that can get a little too clogged up if happen to have
multiple reasons. Would like to have the PageHeader BackColor change
depending on the reason the customer was included. Will rank the reasons,
so
the most important reason's color will be the one to print.

Have tried dozens of combinations of events and keep getting errors. Below
is a short example.
Is this even possible to do?

Private Sub PageHeader_Print(Cancel As Integer, FormatCount As Integer)

If curAmntDue > 100 Then tried
IIf and also [] around field name
Me!PageHeader.BackColor = 16777164 tried ! and
.(period)
Else
Me!PageHeader.BackColor = 65535
End If

Additional Ifs or maybe use Chose to select more colors here

End Sub
 

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