O
owp^3
Doug Steele helped me out a couple of months ago with a way to easily have
all the controls on a form behave the same way using Functions in the
appropriate Event attribute.
So for example, if I want certain controls on a form to change color when
the control has focus then I would write two functions GF() and LF() to
toggle the BackColor property by setting each Control's On Got Focus event
=GF() and On Lost Focus = LF().
This is pretty slick because then I can select all of the controls at once
and set the event properties at once.
So here is my current problem:
We originally did this in a Single Form. Now I'm trying it with a
Continuous Form. The problem is the event handling isn't limited to the
active record. Since I am use Me.ActiveControl.PROPERTY the function applies
the property value to the corresponding control on every record. I want it
to only apply to the control on the active record.
What do I need to change in the following code:
Function GF()
Me.ActiveControl.BackColor = 13434828
If Me.ActiveControl.Controls.Count > 0 Then _
Me.ActiveControl.Controls (0).FontWeight = 700
End Function
Function LF()
Me.ActiveControl.BackColor = vbWhite
If Me.ActiveControl.Controls.Count > 0 Then _
Me.ActiveControl.Controls(0).FontWeight = 400
End Function
Function AU()
Me.ActiveControl.FontBold = True
End Function
Thanks in advance...
owp^3
all the controls on a form behave the same way using Functions in the
appropriate Event attribute.
So for example, if I want certain controls on a form to change color when
the control has focus then I would write two functions GF() and LF() to
toggle the BackColor property by setting each Control's On Got Focus event
=GF() and On Lost Focus = LF().
This is pretty slick because then I can select all of the controls at once
and set the event properties at once.
So here is my current problem:
We originally did this in a Single Form. Now I'm trying it with a
Continuous Form. The problem is the event handling isn't limited to the
active record. Since I am use Me.ActiveControl.PROPERTY the function applies
the property value to the corresponding control on every record. I want it
to only apply to the control on the active record.
What do I need to change in the following code:
Function GF()
Me.ActiveControl.BackColor = 13434828
If Me.ActiveControl.Controls.Count > 0 Then _
Me.ActiveControl.Controls (0).FontWeight = 700
End Function
Function LF()
Me.ActiveControl.BackColor = vbWhite
If Me.ActiveControl.Controls.Count > 0 Then _
Me.ActiveControl.Controls(0).FontWeight = 400
End Function
Function AU()
Me.ActiveControl.FontBold = True
End Function
Thanks in advance...
owp^3