Control formating

S

Sarah at DaVita

I would like the color of the control to change if the user has there cursor
in it. How can I do that?
 
R

ruralguy via AccessMonster.com

You can use the OnEnter and OnExit events to change the color.
 
S

Sarah at DaVita

Isn't there some way to make this happen throught the whole database with
having to program each control?
 
D

Douglas J. Steele

You don't actually need to program each control.

Create a couple of public functions along the lines of

Function HighlightControl()
Screen.ActiveControl.BackColor = vbRed
End Function

Function RemoveHighlight()
Screen.ActiveControl.BackColor = vbWhite
End Function

Go to your form(s) and select each control for which you want to control the
highlighting (you can select multiple by "roping" them, or clicking on them
one at a time while holding down the shift key).

With the controls selected, go to the Properties sheet and set the On Got
Focus property to "=HighlightControl()" (no quotes, but you need the = in
front and the parentheses at the end). Set the On Lost Focus to
"=RemoveHighlight()"
 
Top