Conditional format in a report

C

CGo

In office 07; I'm trying to format a field in a report. I can change the
color of the text depending if the order is late or due within the next 30
days. What I am trying to do is change the background of the due date column
depending on what quarter it falls in. I've tried just typing in the date
but that doesn't seem to work. Any suggestions??

Thanks
Chris
 
A

Al Campagna

CGo,
Using Conditional Formatting against a date field named DOC...
Month([DOC]) In (1,2,3)
This would allow a color selection for any date within the first
quarter.
Month([DOC]) In (4,5,6)
For second quarter...
Month([DOC]) In (7,8,9)
For third quarter

Most folks think there are only 3 conditions allowed in conditional
formatting, but logically there are 4.
If a Month(date) is not any of the above, 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
DOC.BackColor = QBColor(14)
ElseIf Month(DOC) = 4 Or Month(DOC) = 5 Or Month(DOC) = 6 Then
DOC.BackColor = QBColor(11)
' etc etc for all 4 quarters
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

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