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

Changing Record Color in a Report (Conditional) 1

Status
Not open for further replies.

Hayton

Technical User
Oct 17, 2001
257
NZ
Good Morning Everyone,

I have a report which is based on a table/query. In the table I have a check box. If I select the check box, I would like that record to appear in red on the report.

I have tried conditional formatting and some vba and can't get it to work for a single record, it formats the whole sheet (All the records)

Any Ideas?
Thanx
 
You need to build an if statement in the detail format event.

If <condition> then
me.detail.backcolor = ### ' desired color
else
me.detail.backcolor = #### ' default color
endif
 
Hi John, thanks for the code. Is there a way that we could make it highlight the text and not the background of the report.

Thanks
 
Yes, but it is a bit more work. It is essientially a loop within the (already given) conditional. The loop is (approximatly):

[tab]For each Ctrl in Me.Detail.Controls
[tab][tab]Ctrl.ForeColor = <desired color.
[tab]Next Ctrl

Not that &quot;Ctrl&quot; must be declared as control. Depending on some details, you may need to check the control type and skip any where there is no &quot;ForeaColor&quot;.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top