color text in report

S

shwan

I have a 3 text (High , Normal , Low ) in filed bound to txt.remark filed , I
want in print out [txt.remark] appear in a diffrent color depending on value
in feild [Result] , I tried to do this but i couldn't this the code that I
write it

Dim txt_Remark As String

Private Sub Report_Current()

Select Case txt_Remark
Case "low"
Me.txt_Remark = vbred
Case "normal"
Me.txt_Remark = vbBlack
Case "high" 'used brakets because two words
Me.txt_Remark = vbred
End Select

End Sub

Please I want some one help me to correct this
 
M

Marshall Barton

shwan said:
I have a 3 text (High , Normal , Low ) in filed bound to txt.remark filed , I
want in print out [txt.remark] appear in a diffrent color depending on value
in feild [Result] , I tried to do this but i couldn't this the code that I
write it

Dim txt_Remark As String

Private Sub Report_Current()

Select Case txt_Remark
Case "low"
Me.txt_Remark = vbred
Case "normal"
Me.txt_Remark = vbBlack
Case "high" 'used brakets because two words
Me.txt_Remark = vbred
End Select

End Sub


Because you declared txt_Remarkas a VBA string you will not
affect what is displayed in the report. Since txtRemark is
a bound control in the report, you need to set its
properties and you have to specify the property (ForeColor,
BackColor, BorderColor) that should have the color:

Me.txtRemark.ForeColor = vbred

I can't be sure what the actual name of the text box real;y
is so make sure you use the name in your report.
 
F

fredg

I have a 3 text (High , Normal , Low ) in filed bound to txt.remark filed , I
want in print out [txt.remark] appear in a diffrent color depending on value
in feild [Result] , I tried to do this but i couldn't this the code that I
write it

Dim txt_Remark As String

Private Sub Report_Current()

Select Case txt_Remark
Case "low"
Me.txt_Remark = vbred
Case "normal"
Me.txt_Remark = vbBlack
Case "high" 'used brakets because two words
Me.txt_Remark = vbred
End Select

End Sub

Please I want some one help me to correct this

Use conditional formatting instead of code.
Select the [txt_Remark] control.
Click on Format + Conditional Formatting
Set Condition1 to
Field Value is
as Condition enter
equal to "medium"
Select the Black color
Click on the Add button

Set Condition2
to
Expression is
write in the next dialog box:
[txt_Remark] = "high" or [txt_Remark] = "low"
Select the red color
Save the changes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top