conditional format of field

Bradon

Board Regular
Joined
Dec 18, 2002
Messages
66
I am using access 2000 and want to change either background or font colour according to the word chosn from a combo box. I tried using conditional formatting but couldn't persuade it to accept an if statement.

The code below works but changes the field colors in every .

Can anybody spot the glitch or come up with an answer?

Thanks

Gordon


Private Sub Outjoin1_Change()

Select Case Outjoin1.Value

Case "his" 'Blue
Outjoin1.ForeColor = "16711680"

Case "He" 'Blue
Outjoin1.ForeColor = "16711680"

Case "her" 'Pink
Outjoin1.ForeColor = "4612615935"

Case "she" 'Pink
Outjoin1.ForeColor = "12615935"

Case Else
Outjoin1.ForeColor = "0"

End Select

End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
There doesn't seem to be a glitch in the code.

What is the purpose of this change - are you making the cell go pink for females and blue for boys. Sorry i cant help, but i am interested in knowing if there is a way of doing this so that i can apply it to some of my databases.
 
Upvote 0
Naff colour choice but I had to start somewhere!

The code works and changes the text colour on entry according to the word entered from a combo box. The problem is that it appears to work on the page in front of you but it also changes the text colour of all other pages of the form, irrespective of the words in the field.

The object of the excercise is to provide a simple colour match warning to users to ensure they do not select "he" or "him" for a girl student when writing reports using comment banks.

My dream would be to have an automatic word replacement appropriate for male or female students but that is way beyond my ability.

I had previously tried to use conditional formatting but couldn't work out how to get it to accept an OR statement.

As I am only using He, His, She and Her I have set the contitional format to a text colour as a default and the alternative text colour for He and His. Crude but is a get me by solution. The problem is that teachers have a habit of dreaming up still more words....


Thanks for your interest and if you have any ideas they would be welcome.


Gordon
 
Upvote 0

Forum statistics

Threads
1,221,575
Messages
6,160,603
Members
451,657
Latest member
Ang24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top