Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Conditional Formatting

Discussion in 'Information Technology' started by Appache, Jul 28, 2006.

  1. Appache

    Appache
    Expand Collapse
    Guest

    I have two checkboxes in an continuous form and I want to change the color of
    labels which are associated with these checkboxes. I read sth on internet and
    figured out I cant use conditional formatting with checkbox so I try to find
    out another solution and came up with this. I deleted labels and add two
    texboxes and tried to use conditional formatting on that texboxes. I chosed
    Expression Is and wrote [MycheckboxName]=True as my condition in order to
    change the color of textbox if checkbox is checked. Everything is ok but when
    the backcolor of the texbox changes, it also changes the text with 0 or -1
    which is weird for me. Is there any way to do it without changing text ? The
    text in the textbox is static.

    --
    Thanks
     
  2. Loading...

    Similar Threads Forum Date
    Inspirational Unconditional love for the Guru Videos Sep 4, 2010
    General Unconditional Love Hard Talk Jun 28, 2008
    Pure and Unconditional Love for God Gurmat Vichaar Feb 18, 2008

  3. Wayne-I-M

    Wayne-I-M
    Expand Collapse
    Guest

    Hi

    This would change the lable [LableA1] if you checked the checkbox
    [MycheckboxName] Font will be Red and Bold. Back colour would be Yellow.
    You will need to change the colors to what you want.


    Private Sub MycheckboxName_AfterUpdate()
    On Error GoTo MycheckboxName_AfterUpdate_Err

    If Me.MycheckboxName = 1 = True Then
    Me.LabelA1.BackColor = vbYellow
    Me.LabelA1.ForeColor = vbRed
    Me.LableA1.FontBold = True

    Else
    Me.LabelA1.BackColor = vbBlack
    Me.LabelA1.ForeColor = vbGreen
    Me.LableA1.FontBold = False

    End If

    End Sub


    --
    Wayne
    Manchester, England.



    "Appache" wrote:

    > I have two checkboxes in an continuous form and I want to change the color of
    > labels which are associated with these checkboxes. I read sth on internet and
    > figured out I cant use conditional formatting with checkbox so I try to find
    > out another solution and came up with this. I deleted labels and add two
    > texboxes and tried to use conditional formatting on that texboxes. I chosed
    > Expression Is and wrote [MycheckboxName]=True as my condition in order to
    > change the color of textbox if checkbox is checked. Everything is ok but when
    > the backcolor of the texbox changes, it also changes the text with 0 or -1
    > which is weird for me. Is there any way to do it without changing text ? The
    > text in the textbox is static.
    >
    > --
    > Thanks
     
  4. Appache

    Appache
    Expand Collapse
    Guest

    Thank you for your answer but I think it's not the solution because when I go
    to next record and come back all the labels show up black again. I want to
    save the color unless somebody unchecks the checkbox.
    --
    Thanks


    "Wayne-I-M" wrote:

    > Hi
    >
    > This would change the lable [LableA1] if you checked the checkbox
    > [MycheckboxName] Font will be Red and Bold. Back colour would be Yellow.
    > You will need to change the colors to what you want.
    >
    >
    > Private Sub MycheckboxName_AfterUpdate()
    > On Error GoTo MycheckboxName_AfterUpdate_Err
    >
    > If Me.MycheckboxName = 1 = True Then
    > Me.LabelA1.BackColor = vbYellow
    > Me.LabelA1.ForeColor = vbRed
    > Me.LableA1.FontBold = True
    >
    > Else
    > Me.LabelA1.BackColor = vbBlack
    > Me.LabelA1.ForeColor = vbGreen
    > Me.LableA1.FontBold = False
    >
    > End If
    >
    > End Sub
    >
    >
    > --
    > Wayne
    > Manchester, England.
    >
    >
    >
    > "Appache" wrote:
    >
    > > I have two checkboxes in an continuous form and I want to change the color of
    > > labels which are associated with these checkboxes. I read sth on internet and
    > > figured out I cant use conditional formatting with checkbox so I try to find
    > > out another solution and came up with this. I deleted labels and add two
    > > texboxes and tried to use conditional formatting on that texboxes. I chosed
    > > Expression Is and wrote [MycheckboxName]=True as my condition in order to
    > > change the color of textbox if checkbox is checked. Everything is ok but when
    > > the backcolor of the texbox changes, it also changes the text with 0 or -1
    > > which is weird for me. Is there any way to do it without changing text ? The
    > > text in the textbox is static.
    > >
    > > --
    > > Thanks
     
  5. Wayne-I-M

    Wayne-I-M
    Expand Collapse
    Guest

    Hi

    You can't. If your checkbox is bound to a field then it's doing what it's
    meant to.

    Say the question is "Wayne likes a cup of tea with his lunch"
    If the answer = True
    Then this answer will stay like this until you uncheck the box "for this
    record only" and the lable formating (see my last post) will stay like this.
    It may be the someone else has the answer "false" and so the lables will stay
    in the format (color, bold/not bold, etc) that you have set for this responce
    "from this record".

    This only way to save the formating would be to have an unbound check box -
    but what would be the point of that.

    Hope this helps.

    --
    Wayne
    Manchester, England.



    "Appache" wrote:

    > Thank you for your answer but I think it's not the solution because when I go
    > to next record and come back all the labels show up black again. I want to
    > save the color unless somebody unchecks the checkbox.
    > --
    > Thanks
    >
    >
    > "Wayne-I-M" wrote:
    >
    > > Hi
    > >
    > > This would change the lable [LableA1] if you checked the checkbox
    > > [MycheckboxName] Font will be Red and Bold. Back colour would be Yellow.
    > > You will need to change the colors to what you want.
    > >
    > >
    > > Private Sub MycheckboxName_AfterUpdate()
    > > On Error GoTo MycheckboxName_AfterUpdate_Err
    > >
    > > If Me.MycheckboxName = 1 = True Then
    > > Me.LabelA1.BackColor = vbYellow
    > > Me.LabelA1.ForeColor = vbRed
    > > Me.LableA1.FontBold = True
    > >
    > > Else
    > > Me.LabelA1.BackColor = vbBlack
    > > Me.LabelA1.ForeColor = vbGreen
    > > Me.LableA1.FontBold = False
    > >
    > > End If
    > >
    > > End Sub
    > >
    > >
    > > --
    > > Wayne
    > > Manchester, England.
    > >
    > >
    > >
    > > "Appache" wrote:
    > >
    > > > I have two checkboxes in an continuous form and I want to change the color of
    > > > labels which are associated with these checkboxes. I read sth on internet and
    > > > figured out I cant use conditional formatting with checkbox so I try to find
    > > > out another solution and came up with this. I deleted labels and add two
    > > > texboxes and tried to use conditional formatting on that texboxes. I chosed
    > > > Expression Is and wrote [MycheckboxName]=True as my condition in order to
    > > > change the color of textbox if checkbox is checked. Everything is ok but when
    > > > the backcolor of the texbox changes, it also changes the text with 0 or -1
    > > > which is weird for me. Is there any way to do it without changing text ? The
    > > > text in the textbox is static.
    > > >
    > > > --
    > > > Thanks
     
  6. Wayne-I-M

    Wayne-I-M
    Expand Collapse
    Guest

    Ooops

    Sorry forget all that (last post) I have just re-read your question.

    Yes you can.

    Copy the formating (don't delet it from the AfterUpdate - simply copy it)
    and paste it into the OnLoad action. This will mean that the formating is
    loaded when you open the form and it will also be actioned when you make
    changes to the CheckBox.


    --
    Wayne
    Manchester, England.



    "Appache" wrote:

    > Thank you for your answer but I think it's not the solution because when I go
    > to next record and come back all the labels show up black again. I want to
    > save the color unless somebody unchecks the checkbox.
    > --
    > Thanks
    >
    >
    > "Wayne-I-M" wrote:
    >
    > > Hi
    > >
    > > This would change the lable [LableA1] if you checked the checkbox
    > > [MycheckboxName] Font will be Red and Bold. Back colour would be Yellow.
    > > You will need to change the colors to what you want.
    > >
    > >
    > > Private Sub MycheckboxName_AfterUpdate()
    > > On Error GoTo MycheckboxName_AfterUpdate_Err
    > >
    > > If Me.MycheckboxName = 1 = True Then
    > > Me.LabelA1.BackColor = vbYellow
    > > Me.LabelA1.ForeColor = vbRed
    > > Me.LableA1.FontBold = True
    > >
    > > Else
    > > Me.LabelA1.BackColor = vbBlack
    > > Me.LabelA1.ForeColor = vbGreen
    > > Me.LableA1.FontBold = False
    > >
    > > End If
    > >
    > > End Sub
    > >
    > >
    > > --
    > > Wayne
    > > Manchester, England.
    > >
    > >
    > >
    > > "Appache" wrote:
    > >
    > > > I have two checkboxes in an continuous form and I want to change the color of
    > > > labels which are associated with these checkboxes. I read sth on internet and
    > > > figured out I cant use conditional formatting with checkbox so I try to find
    > > > out another solution and came up with this. I deleted labels and add two
    > > > texboxes and tried to use conditional formatting on that texboxes. I chosed
    > > > Expression Is and wrote [MycheckboxName]=True as my condition in order to
    > > > change the color of textbox if checkbox is checked. Everything is ok but when
    > > > the backcolor of the texbox changes, it also changes the text with 0 or -1
    > > > which is weird for me. Is there any way to do it without changing text ? The
    > > > text in the textbox is static.
    > > >
    > > > --
    > > > Thanks
     
  7. Appache

    Appache
    Expand Collapse
    Guest

    Thank you very much..I tried it and it worked but I didnt add your code to
    under Form's Load action.I paste that code under Form's current action. I
    also didnt delete this code from afterupdate action.
    --
    Thanks


    "Wayne-I-M" wrote:

    > Ooops
    >
    > Sorry forget all that (last post) I have just re-read your question.
    >
    > Yes you can.
    >
    > Copy the formating (don't delet it from the AfterUpdate - simply copy it)
    > and paste it into the OnLoad action. This will mean that the formating is
    > loaded when you open the form and it will also be actioned when you make
    > changes to the CheckBox.
    >
    >
    > --
    > Wayne
    > Manchester, England.
    >
    >
    >
    > "Appache" wrote:
    >
    > > Thank you for your answer but I think it's not the solution because when I go
    > > to next record and come back all the labels show up black again. I want to
    > > save the color unless somebody unchecks the checkbox.
    > > --
    > > Thanks
    > >
    > >
    > > "Wayne-I-M" wrote:
    > >
    > > > Hi
    > > >
    > > > This would change the lable [LableA1] if you checked the checkbox
    > > > [MycheckboxName] Font will be Red and Bold. Back colour would be Yellow.
    > > > You will need to change the colors to what you want.
    > > >
    > > >
    > > > Private Sub MycheckboxName_AfterUpdate()
    > > > On Error GoTo MycheckboxName_AfterUpdate_Err
    > > >
    > > > If Me.MycheckboxName = 1 = True Then
    > > > Me.LabelA1.BackColor = vbYellow
    > > > Me.LabelA1.ForeColor = vbRed
    > > > Me.LableA1.FontBold = True
    > > >
    > > > Else
    > > > Me.LabelA1.BackColor = vbBlack
    > > > Me.LabelA1.ForeColor = vbGreen
    > > > Me.LableA1.FontBold = False
    > > >
    > > > End If
    > > >
    > > > End Sub
    > > >
    > > >
    > > > --
    > > > Wayne
    > > > Manchester, England.
    > > >
    > > >
    > > >
    > > > "Appache" wrote:
    > > >
    > > > > I have two checkboxes in an continuous form and I want to change the color of
    > > > > labels which are associated with these checkboxes. I read sth on internet and
    > > > > figured out I cant use conditional formatting with checkbox so I try to find
    > > > > out another solution and came up with this. I deleted labels and add two
    > > > > texboxes and tried to use conditional formatting on that texboxes. I chosed
    > > > > Expression Is and wrote [MycheckboxName]=True as my condition in order to
    > > > > change the color of textbox if checkbox is checked. Everything is ok but when
    > > > > the backcolor of the texbox changes, it also changes the text with 0 or -1
    > > > > which is weird for me. Is there any way to do it without changing text ? The
    > > > > text in the textbox is static.
    > > > >
    > > > > --
    > > > > Thanks
     

Share This Page