Results 1 to 12 of 12
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    BackColor/Text (2003)

    I have a control in a form, which I want to change colour if a yes/no control in a subform is Yes, but BackColor doesn't seem to work.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: BackColor/Text (2003)

    Make sure that the Back Style property of the control is set to Normal, not Transparent. Are you using Conditional Formatting?

  3. #3
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: BackColor/Text (2003)

    Yes, the BackColor is set to normal. No, I'm not using conditional formatting.

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: BackColor/Text (2003)

    If you are trying to do this with code, can you post the code you are using.

    If you are not using code, how are you doing it?
    Regards
    John



  5. #5
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: BackColor/Text (2003)

    The code I'm using is :-

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If Me.OnHold = Yes Then
    Me.Tooling_Number.BackColor = 255
    Else
    Me.Tooling_Number.BackColor = vbWhite
    End If

    End Sub

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: BackColor/Text (2003)

    You initially wrote about a form and a subform, but the Detail_Format event is for reports only. Can you provide the correct information, please?

  7. #7
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: BackColor/Text (2003)

    I think this is where I've gone wrong. What property should it be in?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: BackColor/Text (2003)

    What is it for? A form or a report? Please give us relevant information.

  9. #9
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: BackColor/Text (2003)

    My apologies, it's for a form.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: BackColor/Text (2003)

    Ok, you need to put the code

    If Me.OnHold = True Then ' use True instead of Yes in VBA
    Me.Tooling_Number.BackColor = 255
    Else
    Me.Tooling_Number.BackColor = vbWhite
    End If

    in the After Update event of OnHold, so that the color will change if the user clicks the check box, and in the On Current event of the form, so that the color will change as the user moves from record to record.

    You could also use conditional formatting for Tooling_Number instead of code.

  11. #11
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: BackColor/Text (2003)

    I tried conditional formatting as well as code and still get nothing. Do I need to specify that OnHold is in the subform and Tooling_Number is in the main form.

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: BackColor/Text (2003)

    If Tooling_Number is in the main form, Me.Tooling_Number is not valid - in the subform, Me refers to the subform. Replace Me.Tooling_Number with Me.Parent.Tooling_Number in the code.

Posting Permissions

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