Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2002
    Posts
    14

    Unanswered: Conditional colour change of field

    I have a field that is a check-box and wish it to display a different colour
    once the check box has been ticked (e.g turns red, flashes,etc as a reminder to users)

    Any help appreciated.

  2. #2
    Join Date
    Jul 2002
    Posts
    5
    I didn't find any way to change the color of the check box itself, but I use the following code to change the color of the label. You can use this code in the OnClick event of the control, or in the OnCurrent event of the form... depends on how you want the update to happen.

    If Check1.Value = True Then
    Label1.BackColor = RGB(255, 0, 0) 'Red
    Else
    Label1.BackColor = Detail.BackColor
    End If

  3. #3
    Join Date
    Jul 2002
    Posts
    67
    I could be wrong...but I don't think you can change the backcolor of a checkbox in MS Access. In the past I have put square around the checkbox, set it's width to 1 or 2 and make it any color you like when a user clicks on it. Rework the same code in the previous post to this thread and I think you will be in business.
    Don't do today, what can be done tomorrow.

  4. #4
    Join Date
    Jun 2002
    Posts
    14

    Label colour change

    Thanks.
    I tried this for OnClick but does not seem to work:

    If Debtor.Value = True Then
    Debtorlabel.BackColor = RGB(255, 0, 0) 'Red'
    Else
    Debtorlabel.BackColor = Detail.BackColor
    End If

    Originally posted by aculharobed
    I didn't find any way to change the color of the check box itself, but I use the following code to change the color of the label. You can use this code in the OnClick event of the control, or in the OnCurrent event of the form... depends on how you want the update to happen.

    If Check1.Value = True Then
    Label1.BackColor = RGB(255, 0, 0) 'Red
    Else
    Label1.BackColor = Detail.BackColor
    End If

  5. #5
    Join Date
    Jul 2002
    Posts
    67

    Re: Label colour change

    Originally posted by toast


    If Debtor.Value = True Then
    Debtorlabel.BackColor = RGB(255, 0, 0) 'Red'
    Else
    Debtorlabel.BackColor = Detail.BackColor
    End If
    **************************

    Try this: (using a square around the checkbox)

    Private Sub chkTest_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Me.chkTest.Value = True Then
    Me.boxTest.BorderColor = vbRed
    Else
    Me.boxTest.BorderColor = vbBlack
    End If
    End Sub

    I tested it and it works but I don't know if this what you actually want.
    Don't do today, what can be done tomorrow.

Posting Permissions

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