compare dates on report

  • Thread starter Thread starter cronept
  • Start date Start date
C

cronept

I tried to make a warning function on a report, that is if
PdwgSchedule date is only 7 days left, and another date "P_SubAct" is
null, then "P_SubAct" filed will be changed to red color. But it
doesn't work. Can anybody kindly help me find out what's wrong in my
code? THanks a lot.
---------------------------------------------------------------------
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If (Me.Today - Me.PdwgSchedule) < 7 And IsNull(P_SubAct) Then
Me.P_SubAct.BackColor = vbRed
ElseIf (Me.Today - Me.PdwgSchedule) >= 7 And IsNull(P_SubAct) Then
Me.P_SubAct.BackColor = vbWhite
End If
end sub
 
It would help if you defined what doesn't work.

One thing I see is that if P_SubAct isn't null, you haven't got logic in to
change the colour if the previous row was red.

You might also try DateDiff("d", Me.Today, Me.PdwgSchedule) instead of just
subtracting.
 
Back
Top