Dick7Access
Dick S
- Local time
- , 20:41
- Joined
- Jun 9, 2009
- Messages
- 4,298
Hi,
I have a function that changes the color of each field when it has the focus. It worked well until I changed two fields to combobox, one for states, and the other a “from” field so that only a selected from list will be entered.. Now the fields stay the highlighted color after it loses the focus. I think that the reason that they do is the function is not noticing the combbox and only looking for text fields, but I don’t know how to change it. Here is the code.
Sub HighFocus() ' Changes the color of whatever field is highlighted
Dim Cont3 As Control
For Each Cont3 In Me
If Cont3.ControlType = acTextBox Then 'Checks to see if a text box
Cont3.BackColor = vbWhite
Cont3.BorderColor = vbBlack
End If
Next Cont3
Me.ActiveControl.BackColor = vbYellow
Me.ActiveControl.BorderColor = vbRed
Thanks in advance
DS
I have a function that changes the color of each field when it has the focus. It worked well until I changed two fields to combobox, one for states, and the other a “from” field so that only a selected from list will be entered.. Now the fields stay the highlighted color after it loses the focus. I think that the reason that they do is the function is not noticing the combbox and only looking for text fields, but I don’t know how to change it. Here is the code.
Sub HighFocus() ' Changes the color of whatever field is highlighted
Dim Cont3 As Control
For Each Cont3 In Me
If Cont3.ControlType = acTextBox Then 'Checks to see if a text box
Cont3.BackColor = vbWhite
Cont3.BorderColor = vbBlack
End If
Next Cont3
Me.ActiveControl.BackColor = vbYellow
Me.ActiveControl.BorderColor = vbRed
Thanks in advance
DS