I have created a multiple item form for a simple table, not part of a relationship to any other table. I need help changing the color of a single record textbox control upon the mouse hovering inside the control. I would like to change the color to yellow (like PostIt Note yellow or RGB(255,255,204)). Then, when the mouse cursor is no longer focused on that particular text control for that individual record, the color returns to it's former color. My previous attempts at VBA code would change that text control for the entire field (i.e., every single text box turned yellow in that field). Here is what the multiple item form looks like:
So when my mouse hovers over the box with the "William" record in the [First Name] field, the background color of the text box containing "William" turns yellow, but nothing else turns yellow. So [Last Name], [Phone Number], etc would not change color and no other [First Name] record turns yellow either. Then, when my mouse leaves "William" and moves to "Steven", the "William" text box goes back to the original color and "Steven" becomes yellow, and so on down the [First Name] field. I feel comfortable with both Macro and VBA solutions.
The following code is very close, but produced the wrong result, highlighting every record under the [First Name] field in the multiple item form, instead of just a single text box control of a single record.
Code:
Private Sub txtFirstName_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not Me.txtFirstName.BackColor = vbYellow Then Me.txtFirstName.BackColor = vbYellow
End Sub
Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not Me.txtFirstName.BackColor = vbWhite Then Me.txtFirstName.BackColor = vbWhite
End Sub