Change Textbox background color....

  • Thread starter Thread starter Hanksor
  • Start date Start date
H

Hanksor

Is it possible to change the background color of a report textbox depending
on the value of the field value? Any help will be appreciated.
 
You can use conditional formatting from the "Format" menu while in design
view of the report.
 
Is it possible to change the background color of a report textbox depending
on the value of the field value? Any help will be appreciated.

If you have Access 2000 or newer you could use Conditional formatting.

Click on the control.
then Format + Conditional Formatting

Set the Condition1 drop down to
Field Value Is
Set the value to
equal SomeCriteria (whatever it is)
Select the back color
Save the changes.

In all versions you can code the Format event of whatever section of
the report the control is placed in:

If [SomeControl] = SomeCriteria Then
[SomeControl].BackColor = vbBlue
Else
[SomeControl].BackColor = vbWhite
End If
 
Look at the conditional formatting.
In report design got format/conditional formatting

Chris
 
All versions can use the Format event of the report section
to change the backcolor, forecolor, etc. when the report is
run.

If [AField]>0 Then
[AField].BackColor = vbBlue
[AField].ForeColor = vbYellow
Else
[AField].BackColor = vbWhite
[AField].ForeColor = vbBlack
End If

Chris
 
I've tried this with no results. My field is a text field, could this be an
issue?

Here is my code;

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
If [HowBilled] = "mon" Then
[HowBilled].BackColor = vbBlue
Else
[HowBilled].BackColor = vbRed
End If


Hanksor

Chris Reveille said:
All versions can use the Format event of the report section
to change the backcolor, forecolor, etc. when the report is
run.

If [AField]>0 Then
[AField].BackColor = vbBlue
[AField].ForeColor = vbYellow
Else
[AField].BackColor = vbWhite
[AField].ForeColor = vbBlack
End If

Chris
-----Original Message-----
Unfortunately, We are still in the dark ages with 97. Any Ideas?


"Mark" <:-)> wrote in message news:[email protected]...


.
 
Make sure the BackStyle of the text box is "Normal" and not "Transparent".
If it still doesn't work, then what's the name of the text field? Access
gets confused when a control has the same name as the field in the
underlying table and can't decide which one you want to work with. If the
field is named "HowBilled", then your text box should be named something
different, like "txtHowBilled". In this case, the code would be:
If txtHowBilled = "mon" Then
txtHowBilled.BackColor = vbBlue
Else
txtHowBilled.BackColor = vbRed
End If

Hanksor said:
I've tried this with no results. My field is a text field, could this be
an
issue?

Here is my code;

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
If [HowBilled] = "mon" Then
[HowBilled].BackColor = vbBlue
Else
[HowBilled].BackColor = vbRed
End If


Hanksor

Chris Reveille said:
All versions can use the Format event of the report section
to change the backcolor, forecolor, etc. when the report is
run.

If [AField]>0 Then
[AField].BackColor = vbBlue
[AField].ForeColor = vbYellow
Else
[AField].BackColor = vbWhite
[AField].ForeColor = vbBlack
End If

Chris
-----Original Message-----
Unfortunately, We are still in the dark ages with 97. Any Ideas?


"Mark" <:-)> wrote in message You can use conditional formatting from the "Format" menu while in design
view of the report.

Is it possible to change the background color of a report textbox
depending
on the value of the field value? Any help will be appreciated.






.
 
Try
Me![HowBilled]

Chris
-----Original Message-----
I've tried this with no results. My field is a text field, could this be an
issue?

Here is my code;

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
If [HowBilled] = "mon" Then
[HowBilled].BackColor = vbBlue
Else
[HowBilled].BackColor = vbRed
End If


Hanksor

All versions can use the Format event of the report section
to change the backcolor, forecolor, etc. when the report is
run.

If [AField]>0 Then
[AField].BackColor = vbBlue
[AField].ForeColor = vbYellow
Else
[AField].BackColor = vbWhite
[AField].ForeColor = vbBlack
End If

Chris
-----Original Message-----
Unfortunately, We are still in the dark ages with 97. Any Ideas?


"Mark" <:-)> wrote in message You can use conditional formatting from the "Format" menu while in design
view of the report.

Is it possible to change the background color of a report textbox
depending
on the value of the field value? Any help will be appreciated.






.


.
 
Back
Top