Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Posts
    7

    Red face Unanswered: Option Box & Text Color Changes

    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!!!

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Put that color reset code in your newbutton click event ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •