A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

color text in report



 
 
Thread Tools Display Modes
  #1  
Old May 7th, 2010, 10:42 PM posted to microsoft.public.access.reports
shwan
external usenet poster
 
Posts: 2
Default color text in report

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
  #2  
Old May 8th, 2010, 12:16 AM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default color text in report

shwan wrote:

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.

--
Marsh
MVP [MS Access]
  #3  
Old May 8th, 2010, 12:25 AM posted to microsoft.public.access.reports
fredg
external usenet poster
 
Posts: 4,386
Default color text in report

On Fri, 7 May 2010 14:42:01 -0700, shwan wrote:

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.


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.