C
cmitchel via AccessMonster.com
Good Morning.
I recently made a form that has an option group with 4 toggle buttons.
I coded the following on the option group (before update / after update &
Form Current) to change the color of the text on the button to red once
selected. This works great with one exception.. If I pull up an existing
record then click the New Record button the option group text color change
does not reset and carries over the last chosen text button (stays red)..
Private Sub StatusFrame1_BeforeUpdate(Cancel As Integer)
If Me.StatusFrame1.Value = 1 Then
Me.Toggle31.ForeColor = 255 'red
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 0 'black
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 0 'black
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 0 'black
Me.Toggle34.FontWeight = 400 'normal
End If
If Me.StatusFrame1.Value = 2 Then
Me.Toggle31.ForeColor = 0 'black
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 255 'red
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 0 'black
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 0 'black
Me.Toggle34.FontWeight = 400 'normal
End If
If Me.StatusFrame1.Value = 3 Then
Me.Toggle31.ForeColor = 0 'black
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 0 'black
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 255 'red
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 0 'black
Me.Toggle34.FontWeight = 400 'normal
End If
If Me.StatusFrame1.Value = 4 Then
Me.Toggle31.ForeColor = 0 'black
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 0 'black
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 0 'black
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 255 'red
Me.Toggle34.FontWeight = 400 'normal
End If
End Sub
same for After Update... & Form_Current
I have attempted to add the following to the code with no success:
If Me.StatusFrame1.Value = -1 Then <---- or should it be Null??
Me.Toggle31.ForeColor = 0 'black
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 0 'black
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 0 'black
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 0 'black
Me.Toggle34.FontWeight = 400 'normal
End If
Is there another way to do this? Do I have the correct coding, in the correct
places? Any assistance would be greatly appreciated! Make it a great day!!!
I recently made a form that has an option group with 4 toggle buttons.
I coded the following on the option group (before update / after update &
Form Current) to change the color of the text on the button to red once
selected. This works great with one exception.. If I pull up an existing
record then click the New Record button the option group text color change
does not reset and carries over the last chosen text button (stays red)..
Private Sub StatusFrame1_BeforeUpdate(Cancel As Integer)
If Me.StatusFrame1.Value = 1 Then
Me.Toggle31.ForeColor = 255 'red
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 0 'black
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 0 'black
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 0 'black
Me.Toggle34.FontWeight = 400 'normal
End If
If Me.StatusFrame1.Value = 2 Then
Me.Toggle31.ForeColor = 0 'black
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 255 'red
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 0 'black
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 0 'black
Me.Toggle34.FontWeight = 400 'normal
End If
If Me.StatusFrame1.Value = 3 Then
Me.Toggle31.ForeColor = 0 'black
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 0 'black
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 255 'red
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 0 'black
Me.Toggle34.FontWeight = 400 'normal
End If
If Me.StatusFrame1.Value = 4 Then
Me.Toggle31.ForeColor = 0 'black
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 0 'black
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 0 'black
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 255 'red
Me.Toggle34.FontWeight = 400 'normal
End If
End Sub
same for After Update... & Form_Current
I have attempted to add the following to the code with no success:
If Me.StatusFrame1.Value = -1 Then <---- or should it be Null??
Me.Toggle31.ForeColor = 0 'black
Me.Toggle31.FontWeight = 400 'normal
Me.Toggle32.ForeColor = 0 'black
Me.Toggle32.FontWeight = 400 'normal
Me.Toggle33.ForeColor = 0 'black
Me.Toggle33.FontWeight = 400 'normal
Me.Toggle34.ForeColor = 0 'black
Me.Toggle34.FontWeight = 400 'normal
End If
Is there another way to do this? Do I have the correct coding, in the correct
places? Any assistance would be greatly appreciated! Make it a great day!!!