Can conditional formating affect font color, too?

hirsp1

New member
Local time
Today, 08:53
Joined
Oct 5, 2000
Messages
6
I would like to be able to conditionally change the font color. Is this possible? If so, how?
 
Yes you can change the font colour based upon a condition. You would need to decide what would trigger that change in colour (what value in a field would do this) and what numbers represent the colours you want. Below is an example from a form (that I quickly put together and tested) that will display the language/mother tongue "French" in green and everything else in black.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [MotherTongue] = "French" Then
Me![txtMotherTongue].ForeColor = 123456
Else
Me![txtMotherTongue].ForeColor = 1
End If

End Sub

I hope this helps.

Rich



[This message has been edited by Rich@ITTC (edited 10-12-2000).]
 
Worked great...turned your help into a function and voila!
 
Help w/Conditional formatting

I have a report, based on a query. For each job number there are many records, but I only want the most recent to appear.

This is the code I'm using but it's not working. It's in the details section of the report.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Interim will expire in the query name
'Resubmission date is the date field that I want evaluated.
If Me.Resubmissiondate = DMax("ResubmissionDate", "Interim will expire") Then
Me.ForeColor = vbYellow

Else
'Me.Resubmissiondate.FontBold = False
' Me.Resubmissiondate.ForeColor = vbBlack
Me.FontBold = True
End If

Help would be greatly appreciated.

End Sub
 
Thanks Pat, but I thought I was with the else statement, the Me.FontBold = True

Is there a special way of writing the code for date fields?
How what I'm trying to do is make the most recent submission date turn red, else stay black. How would you go about his?
 
Thanks, but I get a compile error; line two it stops at .forecolor . Any ideas :p
 
Pat

Resubmissions date is the name of the field. When I type resubmission. the only thing that comes up is .value. SHould I be using the Text41. which is the name of the control on the report. If I do this .forecolor doesn't show up either
 
Type it in anyway
Me.Text41.ForeColor= vbRed or whatever colour you want.
not all the properties available for controls in Reports are listed by default, .Visible isn't either. There is a setting somewhere to list them all, I can't remember where though :o
 

Users who are viewing this thread

Back
Top Bottom