chrisjames25
Registered User.
- Local time
- Today, 18:01
- Joined
- Dec 1, 2014
- Messages
- 404
Thanks so much for everyones input on this. Glad we got to a solution that will make my database easier going forwards and hopefully help others in the future.
If (.OnGotFocus = vbNullString) And (.OnLostFocus = vbNullString) Then
.OnGotFocus = "=Hilight([" & .Name & "], True)"
.OnLostFocus = "=Hilight([" & .Name & "], False)"
.Tag = .Tag & IIf(.Tag <> vbNullString, mstrcTagSeparator, Null) & _
mstrcTagBackColor & mstrcTagAssignmnent & .BackColor
End If
Sorry to be a never ending pain but just wondering if you could explain the .tag line in gasmans code to me in plain terms so i can understand what it is achieving
Many thanksCode:If (.OnGotFocus = vbNullString) And (.OnLostFocus = vbNullString) Then .OnGotFocus = "=Hilight([" & .Name & "], True)" .OnLostFocus = "=Hilight([" & .Name & "], False)" .Tag = .Tag & IIf(.Tag <> vbNullString, mstrcTagSeparator, Null) & _ mstrcTagBackColor & mstrcTagAssignmnent & .BackColor End If
Public Function Hilight(ctl As Access.Control, bOn As Boolean)
'Purpose: This code that gets called when focus moves into/out of a control.
'Arguments: ctl = the control whose BackColor should be changed.
' bOn = flag: True if receiving focus, False if losing focus.
' Make label red when control has focus - E.P.Steel (03/10/17)
Dim strBackColor As String
If bOn Then
'Assign the 'got focus' color.
ctl.BackColor = mlngcFocusBackColor
''BUG'' ctl.Controls(0).ForeColor = vbRed
Else
'Restore the color from the control's Tag property (white if not found.)
strBackColor = ReadFromTag(ctl, mstrcTagBackColor)
If IsNumeric(strBackColor) Then
ctl.BackColor = Val(strBackColor)
Else
ctl.BackColor = vbWhite
End If
ctl.Controls(0).ForeColor = vbBlack
End If
End Function
Found issue - My forms labels were not bound to the textbox control.
Thanks again.