Conditional formating of dates in a form

T

Todd

I am trying to get a date to turn red after the date specified has passed.
I tried this code from one of the other posts here, and no luck with it
working.

[forms]![frmMyFormName]![txtMyTextBoxName] < Dateserial(Year(date()),1,1)

I did change the Year to Month, and the date to today().

Thanks

Todd
 
L

Linq Adams via AccessMonster.com

In what event are you posting this code? Where you place it can make a
difference.

If it was me, I'd use Conditional Formatting off the menu!

In Design View, click on to select txtMyTextBoxName

Goto Format - Conditional Formatting

Enter in:

First box: Field Value Is

Second Box: Less Than

Third box: Date()

Now select the formatting you want, changing your colors.


BTW, assuming this code was going in the form this textbox is on, you can
replace

[forms]![frmMyFormName]![txtMyTextBoxName] < Dateserial(Year(date()),1,1)

with

Me.txtMyTextBoxName < Date()
 
Top