Conditional Formatting

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

When I select Conditional Formatting from the Tools menu,
it only allows me up to three FormatConditions. When I
try to code the FormatConditions in VB, it gives me an
error when I try to add more than three. I tried making
duplicates of the controls I want to format, but there is
no way to set the visibility through conditional
formatting. Is there any way to have more than three
FormatConditions for a control?

Thanks,
Andrew
 
I got this from one of the MVPs or website. Have noit
tried it. Maybe one of the MVP's can comment on it?
Watch out for the word wrap.

Jim

Forms Conditional Formatting base on value. Do it on code:
Private Sub cboMyCombo_AfterUpdate()
Me.txtBox1.FontWeight = IIf(Me.cboMyCombo
= "value1", "Normal","Bold")
Me.txtBox2.FontWeight = IIf(Me.cboMyCombo
= "value2", "Normal","Bold")
Me.txtBox3.FontWeight = IIf(Me.cboMyCombo
= "value3", "Normal","Bold")
Me.txtBox4.FontWeight = IIf(Me.cboMyCombo
= "value4", "Normal","Bold")
Me.txtBox5.FontWeight = IIf(Me.cboMyCombo
= "value5", "Normal","Bold")
Me.txtBox6.FontWeight = IIf(Me.cboMyCombo
= "value6", "Normal","Bold")
End Sub

Private Sub Form_Current()
Call cboMyCombo_AfterUpdate
End Sub
 
This would work no problem if I was just working within a
regular form. My problem now is that I am trying to apply
conditional formatting to a subform, where this kind of
coding will change all textboxes, instead of isolating
each one. The Conditional Formatting tool succeeds in
isolating each textbox, but limits me to three.
 
Andrew said:
When I select Conditional Formatting from the Tools menu,
it only allows me up to three FormatConditions. When I
try to code the FormatConditions in VB, it gives me an
error when I try to add more than three. I tried making
duplicates of the controls I want to format, but there is
no way to set the visibility through conditional
formatting. Is there any way to have more than three
FormatConditions for a control?

If you use the Expression option, you can use an ecpression
the contains lots of conditions. You only need to use a
Format Condition for each different format.

What conditions are you trying to use?
 
I need to be able to set a BackColor to one of six
different colors based on the value of the field.
 
Andrew said:
I need to be able to set a BackColor to one of six
different colors based on the value of the field.

Ok, when Stephen says CF is out, it's out. So we have to
come up with a different way. Take a look at one of his
format by criteria techniques at:
www.lebans.com

or try another approach using the ideas at:
http://www.mvps.org/access/forms/frm0024.htm
along with:
http://www.mvps.org/access/forms/frm0055.htm

I can help you with details on the latter technique, but
you'll have to provide more details about the conditions,
colors, etc.
 
Back
Top