Change text based on date

  • Thread starter jbair via AccessMonster.com
  • Start date
J

jbair via AccessMonster.com

I want to change the text color on a report using the attached code but can't
get it to wor not sure where I'm going wrong
txtOrderDueDate is a long date? 12/08/2009

Private Sub Report_Load()
If Me.txtOrderDueDate.Value <= Date + 2 Then
Me.txtOrderDueDate.ForeColor = RGB(255, 0, 0)
Else
Me.txtOrderDueDate.ForeColor = RGB(0, 255, 0)
End If
End Sub
Thanks!
Jerry
 
M

Marshall Barton

jbair said:
I want to change the text color on a report using the attached code but can't
get it to wor not sure where I'm going wrong
txtOrderDueDate is a long date? 12/08/2009

Private Sub Report_Load()
If Me.txtOrderDueDate.Value <= Date + 2 Then
Me.txtOrderDueDate.ForeColor = RGB(255, 0, 0)
Else
Me.txtOrderDueDate.ForeColor = RGB(0, 255, 0)
End If
End Sub


A Report's Load event is not used for Preview or Normal
views (I think it's only for web reports). Instead use the
Format or Print event of the section containing the
txtOrderDueDate text box. Alternatively, you could use
COnditional Formatting.
 
J

jbair via AccessMonster.com

Thanks Marshall works great now!

Marshall said:
I want to change the text color on a report using the attached code but can't
get it to wor not sure where I'm going wrong
[quoted text clipped - 7 lines]
End If
End Sub

A Report's Load event is not used for Preview or Normal
views (I think it's only for web reports). Instead use the
Format or Print event of the section containing the
txtOrderDueDate text box. Alternatively, you could use
COnditional Formatting.
 

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