By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,034 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,034 IT Pros & Developers. It's quick & easy.

Conditional Formatting

P: 20
Hello,

Im trying to use conditional formatting in a text box on a form.

What im trying to do is that conditional formatting changes the colour of the text in the text box. I need the conditional formatting to look up another text box.

This is what i need:
i have one text box which is called colour and it shows various colours.
What i would like to do is in the other text box with conditional formatting is for the text box to change colour but only when there are certain colours in there.

For example i have these colours in my colour text box,

Red, Blue, Black, Green, Yellow.
What i would like is for the conditional formatting to work when the colour Red, Blue or Yellow is in the text box.

Can you please suggest the best way to do this.
If you need any more information please ask
Jun 27 '07 #1
Share this Question
Share on Google+
1 Reply


FishVal
Expert 2.5K+
P: 2,653
Hello,

Im trying to use conditional formatting in a text box on a form.

What im trying to do is that conditional formatting changes the colour of the text in the text box. I need the conditional formatting to look up another text box.

This is what i need:
i have one text box which is called colour and it shows various colours.
What i would like to do is in the other text box with conditional formatting is for the text box to change colour but only when there are certain colours in there.

For example i have these colours in my colour text box,

Red, Blue, Black, Green, Yellow.
What i would like is for the conditional formatting to work when the colour Red, Blue or Yellow is in the text box.

Can you please suggest the best way to do this.
If you need any more information please ask
Hi!

Here is an example of how you can change FormatCondition(0).Forecolor in txtCondFrmt textbox, handling an AfterUpdate event in txtColor textbox where colorname is inputted.

Assumed:
  • [txtCondRfmt] has at list one conditional formatting and only the first is to be changed
  • color name is entered as text to [txtColor]
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtColor_AfterUpdate()
  2.     With Me.txtCondFrmt.FormatConditions(0)
  3.         Select Case Me.txtColor
  4.             Case "Red"
  5.                 .ForeColor = vbRed
  6.             Case "Blue"
  7.                 .ForeColor = vbBlue
  8.             Case "Yellow"
  9.                 .ForeColor = vbYellow
  10.         End Select
  11.     End With
  12. End Sub
  13.  
This is not more than simple example.
Certainly a working version may be more nice.
Jun 27 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.