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

Color Changes

P: 3
I need to write a code that causes the background color and text color of a control when its value changes. for example if the word in the control is Afghanistan i need the background color to be black and font to be white, whereas if the word is USA i need the background color to be green and the font to be black. I think i can do this with Select Case but i can not figure out how to write the code for this. Any help is appreciated.

Chris West
Oct 12 '06 #1
Share this Question
Share on Google+
4 Replies


P: 2
I assume you are doing this on a form? You might try this: In design view left-click on the control in question, select conditional formatting. Itís self explanatory from there.

To add you your question, I am interested in conditional formatting of control A based on the value of the item in control B. If anyone knows how to do this I would love to hear it! Thanks.

Brian Swenson
Oct 12 '06 #2

P: 5
From a theoretical perspective, as I am not a VBA programmer, I would say that using the onChange event of control B you would insert code to change the value of the applicable properties of control A.
Oct 12 '06 #3

P: 3
Conditional formatting works if you only have 3 condition. I potentially have dozens of seperate values that can appear within the same control. That is why i know this can be done with 'Select Case', but i have been unable to figure out how to write the code. Example of written code would be of great help.
Oct 12 '06 #4

P: 9
To change value A in B is lets say "DrSweet".

Change conditional formating to expression and use the expression. Example is here - it could be something else.

IIf(B="DrSweet";A="We have done ti";"Something else")

You also have to assign the right colour etc..

I hope it helps
Oct 17 '06 #5

Post your reply

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