A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Change text based on date



 
 
Thread Tools Display Modes
  #1  
Old December 7th, 2009, 09:19 PM posted to microsoft.public.access.reports
jbair via AccessMonster.com
external usenet poster
 
Posts: 25
Default Change text based on date

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

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/200912/1

  #2  
Old December 7th, 2009, 10:48 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Change text based on date

jbair via AccessMonster.com wrote:

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.

--
Marsh
MVP [MS Access]
  #3  
Old December 9th, 2009, 09:23 PM posted to microsoft.public.access.reports
jbair via AccessMonster.com
external usenet poster
 
Posts: 25
Default Change text based on date

Thanks Marshall works great now!

Marshall Barton wrote:
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.


--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.