Link to home
Start Free TrialLog in
Avatar of Sean Strickland
Sean StricklandFlag for United States of America

asked on

Clean way to change forecolor and backcolor of a textbox (MouseOver)

I'm looking for a clean way to change the fore/back colors of a textbox in Access 97 using the MouseOver event.  Is there some quick code that someone can give me that would allow me to "highlight" boxes using this event.  I'm looking for a way to maybe use a Public Function and pass the variable that is currently under the mouse through it.

I'm thinking in the MouseOver event, you have some code that says:
ChangeColor(Me.Form.HasFocus)

And the ChangeColor function would check to make sure that it's a Text Box, and maybe check to see if there is a stored variable in the tag property?

I'm not really sure, I just want the control to change backcolor when it's hovered onto, and revert back when it loses the mouses' focus.


EDIT:
I've been using something similar to the following to do this, but don't want to do it for every control that I put on the form:

Private Sub txtName_MouseOver()
Me.txtName.BackColor = vbWhite
End Sub
 
Private Sub txtNumber_MouseOver()
Me.txtNumber.BackColor = vbWhite
End Sub
 
Private Sub Detail_MouseOver()
Me.txtName.BackColor = vbRed
Me.txtNumber.Backcolor = vbRed
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Leigh Purvis
Leigh Purvis
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sean Strickland

ASKER

Have a 97 version anywhere/
Ah - meaning you can't open it?
Hmm... hang fire.
Apologoes for not getting back to this as soon as expected.
I eventually converted down to 97 - then though "sod it" and changed it to use Textboxes.
I'm getting a memory address error upon closeup - which I've not get had time to look at.
Here it is for now anyway.
http://www.databasedevelopment.co.uk/experts/TextHover97.zip
"The page cannot be displayed."
Yeah - my website's down at the moment...
Here's the attachments (97 - with remaining error still and 2000 format without - no memory leak).
TextHover97.zip
TextHover.zip