I was looking for the answer to this problem for couple of days. I have my main form "frmAddContact" with navigation sub form called "NavigationSubform". All text fields have glow effect added by placing a button under and changing visibility of the button OnGotFocus and OnLostFocus events. All works perfectly fine when I'm moving in and out on the main form and also when I move to sub form, but the problem occurs when I move from sub form to Main form - focus on sub form remains, so glow is visible on sub form and main form.
How can I remove the focus when I select text box in the main form?
Each text box has following code:
Private Sub [TextBoxName]_GotFocus()
Glow Me.[TextBoxName], Me.[ButtonName], True
End Sub
Private Sub [TextBoxName]_LostFocus()
Glow Me.[TextBoxName], Me.[ButtonName], False
End Sub
Glow method code sits in Module:
Sub Glow(ctlText As Control, ctlShadow As Control, TurnOn As Boolean)
If TurnOn = True Then
ctlText.BorderColor = RGB(102, 175, 233)
ctlShadow.Visible = True
Else
ctlText.BorderColor = RGB(228, 228, 228)
ctlShadow.Visible = False
End If
End Sub
Two text boxes with glow Here