DataBase - Display different colors on the same text box?

Asked By Megaton
20-Nov-09 09:56 PM
This may sound crazy. If I want to display red for negative numbers and
yellow for positive numbers on the same text box on a report, is it possible?

Thanks
QBColor
(1)
Report
(1)
FormatCount
(1)
OnFormat
(1)
Day
(1)
  Al Campagna replied to Megaton
20-Nov-09 10:12 PM
Megaton,
Use the OnFormat event for the report section where your control is
located.
Let's say it is in the Detail section, and the control is named Balance.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Balance < 0 Then
Me.Balance.Forecolor =  QBColor(12) 'lt red
ElseIf Balance = 0 Then
Me.Balance.Forecolor =  QBColor(0)  'black
ElseIf Balance > 0 Then
Me.Balance.Forecolor =  QBColor(14)  'lt yellow
End if
End Sub

You did not indicate what color 0 was, so I included it...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
  fredg replied to Megaton
21-Nov-09 12:30 AM
Set the control's Format property to:

Change [Blue] to whatever color you wish 0 values to display in.


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  Megaton replied to Al Campagna
21-Nov-09 01:24 AM
Brilliant! Thanks a lot.
  Megaton replied to fredg
21-Nov-09 01:59 AM
This works too, although it indent numbers a bit.
Thanks a lot
Create New Account
help
Conditional format in a report DataBase In office 07; I am trying to format a field in a report. I can change the color of the text depending if the order is late or date but that does not seem to work. Any suggestions?? Thanks Chris Access Reports Discussions QBColor (1) Report (1) FormatCount (1) OnFormat (1) Month (1) Quarters (1) CGo, Using Conditional Formatting against a date field use the Default Formatting color to represent the fourth quarter. Also, because this is a report, you can use the OnFormat event of your date control's report section to color the date field background. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If Month(DOC) = 1 Or Month(DOC) = 2 Or Month(DOC) = 3 Then
Conditional formating of date field DataBase I have several date fields on a report which are comapred against a genric due date. i have already set up he conditional 2K? Access Reports Discussions Microsoft Access (1) IsNull (1) Actual_SOS (1) Detail_Format (1) PayDate (1) FormatCount (1) DueDate (1) Gen_SOS (1) Apples, Conditional Formatting does not apply to reports. However, reports have their own way to "imitate" Conditional Formatting. . . Use the OnFormat event of whatever report section your controls are contained in. For example. . . in the Detail section, with a Date1 field that may have Null value. . . If IsNull(Date1) Then Date1.Backcolor = QBColor(12) End If If Date1 could also be a date, then use additional IF statement come up with the following code will it work? Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) Dim datesec As String Dim dategen As String datesec = ("2g_daily_stats_tbl.Start on Site payment is "Late", and should be colored red. Then. . . . Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If IsNull(PayDate) OR PayDate < = DueDate Then PayDate.Backcolor = vbWhite Else PayDate.BackColor change the field names in the underlying table instead? Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If IsNull(Actual_SOS) And Gen_SOS < = Now() Then Actual_SOS.BackColor = vbRed Else If Actual_SOS cccsolutions keywords: Conditional, formating, of, date, field description: I have several date fields on a report which are comapred against a genric due date. i have already set up he conditional
Many thanks in advance~ - - Kirstin McDonald ITC Access Reports Discussions Windows XP (1) QBColors (1) Report (1) FormatCount (1) OptionGroup (1) TeamColor (1) JMednRxr (1) OnFormat (1) Kirstin, Well, that's a interesting question. You can create a table field called TeamColor (Numeric Integer) Report OnFormat. . . Using Forecolor values from properties box. . . TeamColor = 255 (Red) Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) YourFieldName.ForeColor = TeamColor End Sub Using QBColors TeamColor = 1 thru 15 Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) YourFieldName.ForeColor = QBColor(TeamColor) End Sub Using RGB. . . need 3 variables RGB1, RGB2, and RGB3, each possible 0 255. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) YourFieldName.ForeColor = RGB(RGB1, RGB2, RGB3) End Sub I'd try an OptionGroup cccsolutions / index.html Assuming the color code field in the team table is in your report's record source table / query, you can just add an invisible text box to the
Page Footer DataBase hi, here's my scenario of my problem i had one report (Report A) and it has a page footer once i viewed it the page footer appears, but when i sub report the Report A on a another report (Report B) the page footer of Report A does show and it supposed to be shown at the page footer of Report B. its there anyway to show the page footer of Report A to Report B