Conditional Formatting a Date

B

Bazmac

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
 
F

fredg

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.
 
B

Bazmac

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 said:
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
.
 

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