How to change backcolour of Control (1 Viewer)

reddevil1

Registered User.
Local time
Today, 16:17
Joined
Nov 12, 2012
Messages
92
Hi,

What code do i need to change the backcolour of a control to light yellow when it has the focus?

I know how to do this using the Conditional Formatting Manager, but what code goes in the On Go tFocus event?

Would I also need to put code in the On Lost Focus event as well?

me!ControlName.backcolor = vbYellow
The above code does not work?
 
If you have code in the Got Focus event to change the Back Colour, you will also need code to change it back in the Lost Focus event.
 
Thanks JBJ,

Does the below code look OK?
It does not seem to work.

DateReceived.backcolor = vbYellow
The objecvt doesn;t contain the automation object vbYellow
 
Therefore, what coding would i use (and which Event do I put it) if i want to change the background colour of 2 Controls to light yellow when the first control has the focus?

I have tried many different ways but now I am too frustrated!!!

Does the coding go in one or both of the Controls?

Thanks if you can help.
 
Does your control have the same name as the underlying field? This will confuse the Access gnomes. Change your textbox name to txtDateReceived and try again.


Me.txtDateReceived.BackColor = vbYellow
 
TextBox name is
DateReceived_Label

Control name is
DateReceived

Me.DateReceived.BackColor = vbYellow

still gives the same error message
 

Users who are viewing this thread

Back
Top Bottom