russi
03-07-2001, 07:27 AM
I need to have the current field on forms change color when they get focus and revert to original color when lost focus.
I wrote this code for a particular field and it works great!
PROBLEM IS that I have hundreds 9!!) of fields and numerous forms.
How would I make this universal for all fields or at least be able to refer to a macro for this code in each field (so I save having to change the reference to field name each time? PLEASE be explicit so I don't 'get lost'. THANKS.
here is my code:
Private Sub CONTACT_TIME_GotFocus()
Me.ActiveControl.ForeColor = QBColor(15)
Me.ActiveControl.BackColor = QBColor(9)
End Sub
Private Sub CONTACT_TIME_LostFocus()
Me.ActiveControl.ForeColor = 16777215
Me.ActiveControl.BackColor = 8421376
End Sub
I wrote this code for a particular field and it works great!
PROBLEM IS that I have hundreds 9!!) of fields and numerous forms.
How would I make this universal for all fields or at least be able to refer to a macro for this code in each field (so I save having to change the reference to field name each time? PLEASE be explicit so I don't 'get lost'. THANKS.
here is my code:
Private Sub CONTACT_TIME_GotFocus()
Me.ActiveControl.ForeColor = QBColor(15)
Me.ActiveControl.BackColor = QBColor(9)
End Sub
Private Sub CONTACT_TIME_LostFocus()
Me.ActiveControl.ForeColor = 16777215
Me.ActiveControl.BackColor = 8421376
End Sub