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!

Conditional Formatting of one field based on another 1

Status
Not open for further replies.

jabrony76

Technical User
Apr 23, 2001
125
US
Hi all,

I'm trying to create a report that has a txt box with a list of evidence and a check box to the right of that to represent whether the evidence is completed or not.

I want to highlight (specifically bold and red text) the txt box if the check box isn't checked. Thought it would be basic code but it's not working.

Here is the simple code I used:

If Me.Ev1.Value = False Then
Me.Ev1Completed.ForeColor = RGB(255, 0, 0) And Me.Ev1Completed.FontBold = True
End If

I placed this code on the "OnActivate" property of the report and this doesn't do a thing. No error msg, no formatting change either.

Any help would be greatly appreciated.
Thanks!
Andy
 
Place this code in the Detail's Printed event:

If Me!Ev1.Value = False Then
Me!Ev1Completed.ForeColor = 255
Me!Ev1Completed.FontBold = True
End If

Code on!

Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
Hello Andy,
There is no need for code here. Simply right-click the field that you want to appear formatted and choose "Conditional Formatting..." from the menu that appears. In the first combo box, change the value from "Field Value Is" to "Expression Is". In the text box place the text:
Code:
[Ev1] = False
Next select the Bold icon and choose the text color. Click "OK".

That's all there is to it, Robert
•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•
Professional, affordable, Access database solutions and assistance °•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°•°
 
To add to Anthony's post:

You also have to reset the control's properties when the box isn't checked; otherwise all controls after the first checked one will be bolded and red:
Code:
If Me!Ev1.Value = False Then
  Me!Ev1Completed.ForeColor = 255
  Me!Ev1Completed.FontBold = True

Else
Me!Ev1Completed.ForeColor = vbBlack
Me!Ev1Completed.FontBold = False
End If



 
Thanks Cosmo, we are using A97 and that is exactly what we needed! lonniejohnson@prodev.com
ProDev, MS Access Applications B-) ,
May God blow your mind with His Glory in 2003.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top