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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Detail BackColor chaning in code

Status
Not open for further replies.

GweeDo767

Programmer
Dec 30, 2004
3
US
I am trying to get certain lines of a report to have a different color based on the value of "Yes/No" field in a table. The text box "TXTshipped" is currently set to have that very Yes/No field as its control. I set that control to visible=false and then tried this:
If Me.TXTshipped = True Then
Me.Detail.BackColor = RGB(100,0,0)
End If

When I do this in the Detail Format function every line is colored no matter what value is stored in that field. I also noticed that when I type:
Me.TXTshipped.
the drop down box doesn't include all the normal features of a text box control. I am somewhat new to doing programming in Access and can't seem to figure out what I am missing. Please help.
 
Modify the code in:

How To
Alternate Gray Lines on Report
faq703-2684

TomCologne
 
Thanks for the tip, but the problem isn't with getting it to re-color the background. The problem is with the evaluation. It is coloring every line, not just the lines where that field is marked as true.
 
using the Detail's OnFormat Event

If Me.TXTshipped = True Then
Me.Detail.BackColor = RGB(100,0,0)
Else
Me.Detail.BackColor = vbWhite 'Or Whatever the Color is suppose to be
End If

PaulF
 
PaulF: Thanks, worked perfectly. I could have sworn I tried that already.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top