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

Change Font Color On Specific Records

Status
Not open for further replies.

bigmerf

MIS
Oct 4, 2002
247
US
I have a report with several records. Of these records, I want to change the color of a line(record), based on the criteria of a field within that record. Meaning, if "Field A" = "yes" then set the color of the line(record) to red, otherwise leave the line black.

Here's my code:

Code:
if me.fieldA.value = "yes" then
   me.qtenbr.ForeColor = vbRed
   me.SONbr.ForeColor = vbRed
end if

The problem with this code is that it colors ALL records with red if the report finds any of the fieldA records equal "yes". I only want the same record, with the same value of fieldA that equals "yes" to be colored, not all of the records thereafter. I've created this code within the "OnPrint" section of the report.

Can anyone help?
 
Hi!

You need to use conditional formatting. Click into qtengr and choose Format - Conditional Formatting from the menu bar. Then, in the drop down box choose Exression is and a text box will appear to the right. In the text box type Me!fieldA.Value = "yes". Finally, choose the fore color to be red.

Repeat for SONbr

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Wow! I didn't know conditional formatting existed in Access. I thought it was only an Excel function. Thanks for the help jebry!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top