highlight text box on a form

newbieaccess

Registered User.
Local time
Yesterday, 17:43
Joined
Mar 30, 2010
Messages
26
Is there a way to change the highlighting in a form when the user tabs thru their choices to yellow rather than black?

Thank you!!!!
 
You can use;
Code:
Me.ControlName.ForeColor = 65535 [COLOR="SeaGreen"]'Yellow[/COLOR]
and
Code:
Me.ControlName.ForeColor = 0 [COLOR="SeaGreen"]'Black[/COLOR]
to set it back to black.
You could put one in the Control's On Got Focus event and the other in the On Lost Focus event.

There may be a better way of doing this but I can't think of it at the moment.
 
Thank you, I tried it but it's still black. I went to properties On Got focus then Code builder and copied in:
Private Sub Form_GotFocus()
Me.ControlName.ForeColor = 65535 'Yellow
End Sub
Private Sub Form_LostFocus()
Me.ControlName.ForeColor = 0 'Black
End Sub

But, it's not working? Am I doing something wrong ??

Thank you!!! :)
 
What's the name of your control? Put that in the place of controlname....
 
this is probably a really stupid ? but how do I know the name of the control? I just went to property sheet at the form level and put in the code from the ... next to On Got Focus
 
With your form in Design View click in the control, now click on the Other tab of the properties box, the first field on that tab is Name, which will give you the name of that control. If it is a bound field it will more than likely have that same name as the Control Source that is feeding it. If it is unbound it probably has a system assigned name like Text0, unless you have previously changed it.
 
Additionally if you manually type the code into the code window, rather than doing a copy and paste, As soon as you type the Full Stop after Me, Access will automagically drop down a list of valid values that you can choose from.
 

Users who are viewing this thread

Back
Top Bottom