Highlighting Active Field

G

Guest

I read through a previous post on this same subject, but this is a different
"twist":

I would like to highlight the active control as I tab through my forms, but
I don't like using the transparent property to do it because I don't want the
inactive fields to blend into the background.

I've tried setting the backcolor by using Screen.ActiveControl.BackColor in
a public function with the gotfocus and lostfocus events, but I need help.

This method works once I've got a form open, BUT I'm running into problems
when I open a form and the focus goes to the first control. I get the error
"Run-time error '2474': The expression you entered requires the control to be
in the active window."

Here's the code I'm using:

Public Function LeaveControl() 'turn control shading white
Screen.ActiveControl.BackColor = 16777215
End Function
Public Function EnterControl() 'turn control shading yellow
Screen.ActiveControl.BackColor = 13828095
End Function

And then I'll call the appropriate function from each control's gotfocus or
lostfocus event to highlight and turn back to white.

Please give me some direction! Thanks in advance.
 
G

Guest

I just answered my own question:

I didn't realize that Conditional Formatting had a "Field Has Focus"
function that seems to be able to do just what I wanted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top