Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating fields which change on mouse over

Status
Not open for further replies.

cwbviper

Technical User
Oct 22, 2002
101
0
0
GB
I am trying to create an access form where the users will input the data but when the user goes to select the next field with the mouse as the mouse moves over the field the field will change colour. Anyone who can give any help on this would be much appreciated.

Thanks
 
A nice alternative was posted here some-time last year. It may not be what you need but I find it good.

1. Select all the controls that you wish to highlight
2. Set the background colour to highlight colour of your choice.
3. With the controls still selected, set the back style property to tranparent.

This will leave all controls the standard form grey colour until selected and the background colour will then appear.

HTH
 
Paste this sub in a module


Public Sub ChangeColor(Contr$)
Dim ctr As Control
Const ActiveColor = 255 'red
Const IdleColor = 0 'black
On Error Resume Next
For Each ctr In Screen.ActiveForm
If ctr.Name = Contr Then
ctr.BackColor = ActiveColor
Else
ctr.BackColor = IdleColor
End If
Next
End Sub

This code in form's module:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
ChangeColor ("")
End Sub

and for each text box that you want to highlight:

Private Sub ControlName_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
ChangeColor ("ControlName")
End Sub

This is close to what you need...

Good luck
[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top