Make text box go red if after todays date?

hardrock

Registered User.
Local time
Today, 20:45
Joined
Apr 5, 2007
Messages
166
I have a form that loads a amongst other things a "due date" field from a table.
If any due date is shown that is after todays date, i want it show red.
I can make this work for 1 record, just need some help with the loop structure
to test all "due date" records displayed. This is what i have so far that works with 1 record.


If DueDate.Value > Date Then
Me.DueDate.BackColor = vbRed
Else
Me.DueDate.BackColor = vbBlack
End If
 
If this is a single form, just showing one record at the time, just make your code a new sub, which you call from both the DueDate controls after update event, and the forms on current event.

If this is a continuous form, then this approach wont work. Select the duedate control, enter conditional formatting from either the format menu, or through rightclicking the control, select "less than or equal to", then enter the expression Date(), select appropriate format...
 
re:

Thankyou it worked with conditional formatting! is there a way to make the records that past todays date blink?
 
I don't think so with conditional formatting. The olny way I can think of is to use the timer event to check wether the condition is met and flash the background. But I don't think that would be to efficent.
 
Thankyou it worked with conditional formatting! is there a way to make the records that past todays date blink?

Timer function set to 50 ms.

Oh the horror!!!
 

Users who are viewing this thread

Back
Top Bottom