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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Conditional Formatting a Date



 
 
Thread Tools Display Modes
  #1  
Old April 22nd, 2010, 01:27 AM posted to microsoft.public.access
Bazmac
external usenet poster
 
Posts: 15
Default Conditional Formatting a Date

Hi All,

I have a contiuous form with a date field "AppointmentDate" with back style
set to Transperant, which is over an unbound text box "AppointmentColour".

I would like to have "AppointmentColour" change to amber when
"AppointmentDate" = minus 1 day and change to red when "AppointmentDate" =
today

Example: When "AppointmentDate" is 22-04-2010
"AppointmentColour" becomes amber on 21-04-2010
"AppointmentColour" becomes red on 22-04-2010

I have tried using Expression Is [AppointmentDate]=DateAdd("d",-1,Date)
and many other variations but no success.

Could someone please correct my error.

Thanking you in Advance
Bazmac
  #2  
Old April 22nd, 2010, 03:01 AM posted to microsoft.public.access
fredg
external usenet poster
 
Posts: 4,386
Default Conditional Formatting a Date

On Wed, 21 Apr 2010 17:27:01 -0700, Bazmac wrote:

Hi All,

I have a contiuous form with a date field "AppointmentDate" with back style
set to Transperant, which is over an unbound text box "AppointmentColour".

I would like to have "AppointmentColour" change to amber when
"AppointmentDate" = minus 1 day and change to red when "AppointmentDate" =
today

Example: When "AppointmentDate" is 22-04-2010
"AppointmentColour" becomes amber on 21-04-2010
"AppointmentColour" becomes red on 22-04-2010

I have tried using Expression Is [AppointmentDate]=DateAdd("d",-1,Date)
and many other variations but no success.

Could someone please correct my error.

Thanking you in Advance
Bazmac


In Access you must include the () when using the Date() function.
[AppointmentDate]=DateAdd("d",-1,Date())
and the expression needs to go in the AppointmentColor Conditional
Formatting.
The () is not necessary in VBA.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old April 26th, 2010, 12:40 AM posted to microsoft.public.access
Bazmac
external usenet poster
 
Posts: 15
Default Conditional Formatting a Date

Fred,

Thankyou for the reply I have tried your suggestion, but still cannot get it
to work.

I have BackStyle = Normal
BackColour = Automatic

Any other thoughts.

Bazmac


"fredg" wrote:

On Wed, 21 Apr 2010 17:27:01 -0700, Bazmac wrote:

Hi All,

I have a contiuous form with a date field "AppointmentDate" with back style
set to Transperant, which is over an unbound text box "AppointmentColour".

I would like to have "AppointmentColour" change to amber when
"AppointmentDate" = minus 1 day and change to red when "AppointmentDate" =
today

Example: When "AppointmentDate" is 22-04-2010
"AppointmentColour" becomes amber on 21-04-2010
"AppointmentColour" becomes red on 22-04-2010

I have tried using Expression Is [AppointmentDate]=DateAdd("d",-1,Date)
and many other variations but no success.

Could someone please correct my error.

Thanking you in Advance
Bazmac


In Access you must include the () when using the Date() function.
[AppointmentDate]=DateAdd("d",-1,Date())
and the expression needs to go in the AppointmentColor Conditional
Formatting.
The () is not necessary in VBA.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
.

 




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 03:15 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.