Solved Changing the colour of a textbox on a continuous form based on a combobox

Sam Summers

Registered User.
Local time
Today, 06:27
Joined
Sep 17, 2001
Messages
939
I have tried so many things to achieve this and no luck.

I am trying to conditionally change the backcolour of a textbox on a continuous form based on a combobox value on the same form.

I tried conditional formatting and also vba in the on load event of the form but nothing works?

Any ideas?

Many thanks in advance
 
Make the combo box have 2 columns,
Item to pick and the color.

In the afterupdate event:
Me.backcolor = cboBox.column(1)

Note: in vb,columns begin with zero.
 
Above will not work. It cannot be done in a continuous form using vba. Must use CF
backcolour of a textbox on a continuous form
Expression is: [CboBoxName] = "SomeValue"
 
Above will not work. It cannot be done in a continuous form using vba. Must use CF

Expression is: [CboBoxName] = "SomeValue"
Its not the combobox i want to change the colour of. I want to change the colour of the textbox based on what is selected in the combobox if its possible. Basically i am reducing the combobox to nothing and making the textbox display the contents of the combobox so that the user isn't tempted to try and select from the drop down list.

Hope that makes sense?
 
I want to change the colour of the textbox based on what is selected in the combobox if its possible.
Yes that is exactly why I used "Expression Is" instead of "Field Value Is" .
cond.jpg
 
Is the value you are looking for really the 3rd column (0 based) and it is not the bound field? Make sure status is the name of the combo. Also no [] around Column. Only needed around the control name.
 
Is the value you are looking for really the 3rd column (0 based) and it is not the bound field? Make sure status is the name of the combo. Also no [] around Column. Only needed around the control name.
Yes done all that and checked that i am referring to the right column and still nothing? Very strange
 
Right i think i have found the problem. Its because i want the textbox to display the text in the combobox with this - =[Status].[Column](2)
'Status' being the name of the combobox.

It must be conflicting with the conditional formatting expression?
 
Even if Status is a reserved word (which it is not), it would not matter since it is inside [].
You do not need the [] around column, but I tested it with them and it works.
Can you post your db or a sample?
 
Even if Status is a reserved word (which it is not), it would not matter since it is inside [].
You do not need the [] around column, but I tested it with them and it works.
Can you post your db or a sample?
Here it is and thank you
 

Attachments

You need to get rid of the table lookups. These are BAD! You are also creating so much extra work in what you are attempting. See the simple query and simple formatting.

You make combo lookups on forms not in tables. Yes I know that MS thought they were doing people a favor, but they just made it easy to hang yourself.
 

Attachments

FYI. One more thing. Conditional formatting does not work well with transparent controls. In order to change the back color need to set to Normal. I made it look transparent, by giving the background color same as the form color.
 
FYI. One more thing. Conditional formatting does not work well with transparent controls. In order to change the back color need to set to Normal. I made it look transparent, by giving the background color same as the form color.
Thank you. I note all your points and will have a go at putting it into action. I am slowly learning
 

Users who are viewing this thread

Back
Top Bottom