Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing fore colors depending on values in report

Status
Not open for further replies.

CTOROCK

Programmer
May 14, 2002
289
US

Hi,

I'm trying to customize a report to have a differnt color depending on the value for each record. I know I've done this before and forgot how. I tried using this:

Private Sub Report_Open(Cancel As Integer)

txtPriority.SetFocus
If Me.txtPriority.Value = "1" Then
txtPriority.ForeColor.Value = "255"
End If


End Sub


But that doesn't work. Any suggestions appreciated!


"The greatest risk, is not taking one."
 
try this. it will help u.

Private Sub Report_Open(Cancel As Integer)

If Me.txtPriority.Value = "1" Then
txtPriority.ForeColor= vbred
else
txtPriority.ForeColor= vbblack
End If


End Sub
 
Thanks, but that doesn't work. I get an error saying that "You've entered an expression that has no value" hmm

"The greatest risk, is not taking one."
 
sorry sorry...
don't use it in report_open event.
use this or in which section your field you have displayed.

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

If Me.txtPriority.Value = "1" Then
txtPriority.ForeColor= vbred
else
txtPriority.ForeColor= vbblack
End If

end sub
 
This works, thank you very much!

"The greatest risk, is not taking one."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top