format report records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am familiar with conditional formating, but I have more then three
conditions on a report that I would like to change the backround color of a
text box. Could you give me a easy module or macro, that will make the
change.

I am sorting problem events for different departments, and would like the
department name to be color coded (I have more then three departments to
color code). I have the records sorted by department name, and have the
first three different colors, but I am limited to three departments.

Thank you,
 
Cliff said:
I am familiar with conditional formating, but I have more then three
conditions on a report that I would like to change the backround color of a
text box. Could you give me a easy module or macro, that will make the
change.

I am sorting problem events for different departments, and would like the
department name to be color coded (I have more then three departments to
color code). I have the records sorted by department name, and have the
first three different colors, but I am limited to three departments.


You don't need to use CF in reports. Use code in the
section's Format event. General idea is

Select Case dept
Case "Accounting"
Me.Section(??).BackColor = vbRed
Case "Sales"
Me.Section(??).BackColor = vbGreen
Case . . .
. . .
Case Else
Me.Section(??).BackColor = vbWhite
End Select

Mote that code like that is data dependent in that it
contains data values (e.g. "Accounting", "Sales", etc). It
would be **much** better to place the color values in a
field in the table of departments. This way the color code
would be available in a hidden text box on the report and
the code would simply be:

Me.Section(??).BackColor = Me.txtDeptColor

so you whould not need to modify any code procedures when
you add/change a color.
 
Back
Top