Change Text color

  • Thread starter Thread starter Raj
  • Start date Start date
R

Raj

Can someone tell me how I can have the text color and
bold on 4 fields [orderno], [orderdate],[customername],
[shipdate]on my form when and check box is activated.
Thanks in advance
 
This is off the top of my head, others may find a simpler way:
Set default property of checkbox to false.
In the afterupdate event of the checkbox, add the following code:

Private Sub Check1_AfterUpdate()
Me!orderno.FontBold = Me!Check1
Me!orderdate.FontBold = Me!Check1
Me!customername.FontBold = Me!Check1
Me!shipdate.FontBold = Me!Check1
If Me!Check1 Then
Me!orderno.ForeColor = 255 'Red
Me!orderdate.ForeColor = 255
Me!customername.ForeColor = 255
Me!shipdate.ForeColor = 255
Else
Me!orderno.ForeColor = 256 'Black
Me!orderdate.ForeColor = 256
Me!customername.ForeColor = 256
Me!shipdate.ForeColor = 256
End If
End Sub

Damon
 
I would add code to my on_current event of the form. This code runs each
time you move to a new record. The code should say something like:


Private Sub Form_Current()

If [CheckBoxField] then
Me.orderno.FontBold = true
Me.orderno.ForeColor = "255" ' 255 is red

Me.orderdate.FontBold = true
Me.orderdate.ForeColor = "255"
Me.customername.FontBold = true
Me.customername.ForeColor = "255"
Me.shipdate.FontBold = true
Me.shipdate.ForeColor = "255"
End Sub
 
Actually,
you probably would want to set the checkbox to false in the on current event
and the fontcolor and bold properties back to default. With the code in the
afterupdate event of the check box, you can see your changes on each
record....

Damon
 
Hi gentlemen,
I am hoping that someone can help me. I have tried both
codes and I keep getting a
Run-time error '438': object doesn't support this
property or method.
I am not sure what I am doing wrong. All but one of my
fields are textbox and the other is a combo box..
Thanks
Raj
-----Original Message-----
Actually,
you probably would want to set the checkbox to false in the on current event
and the fontcolor and bold properties back to default. With the code in the
afterupdate event of the check box, you can see your changes on each
record....

Damon

Can someone tell me how I can have the text color and
bold on 4 fields [orderno], [orderdate],[customername],
[shipdate]on my form when and check box is activated.
Thanks in advance


.
 
Hi gentlemen,
I am hoping that someone can help me. I have tried both
codes and I keep getting a
Run-time error '438': object doesn't support this
property or method.
I am not sure what I am doing wrong. All but one of my
fields are textbox and the other is a combo box..

On Error Resume Next?
 
Back
Top