Field change color when a date is about to be due or is past due

J

JR

I do almost the same thing in one of my applications. I use the OnCurrent
event but you might be able to use OnOpen or something else. You can also
use the dateadd function to get a date 2 weeks before the current date.

Private Sub Form_Current()

If Me.EffEndDT.Value < Date Then
Me.EffEndDT.BackColor = 255
Else
Me.EffEndDT.BackColor = 16777215
End If

End Sub

Hope this Helps

JR
 
D

David C. Holley

Read up on Conditional Formating. To set the CF for a form field right
click on the field.
 
J

Jessica

Where do i type that in

JR said:
I do almost the same thing in one of my applications. I use the OnCurrent
event but you might be able to use OnOpen or something else. You can also
use the dateadd function to get a date 2 weeks before the current date.

Private Sub Form_Current()

If Me.EffEndDT.Value < Date Then
Me.EffEndDT.BackColor = 255
Else
Me.EffEndDT.BackColor = 16777215
End If

End Sub

Hope this Helps

JR
 
J

JR

Hey conditional formatting is COOL! Looks like I've been doing this the hard
way...

In conditional formatting under condition 1:

"Field Value Is" - "Less Than" - Date()
Then change the background color to red.

Then click "Add" to make another condition.

Under Condition 2:

"Field Value Is" - "between" - Date() - DateAdd("ww",2,Date())
Then change the background color to blue


HTH
JR
 
J

Jessica

Is not working, do i put in the field name where it says Date. I put it
exactly as you type it and it doesn't work.
 
J

JR

No, you don't put in the field name. Access knows which field you mean
because you right-clicked it and selected conditional formatting.

Try using just condition 1 to start.

if you have "Field Value Is" in the first drop down and "Less than" in the
second drop down and Date() in the last field

and

if you changed the background color to red on the "Preview of format to use
when condition is true" line

and

the date in your field is prior to today's date

Then I have no idea why it is not working.
 
D

David C. Holley

Sorry about being vague early. Conditional Formating is only available
when using forms.
 
J

Jessica

What can i do if i want it to show up in the table. Is there a different way
to do it to show up in the table instead of the form.
 
M

Marshall Barton

No. not in a table.

A table is a data repository, it is not supposed to be
exposed to users, who might totally garble its data. Think
of a table sheet view as a debugging aid for the programmer.
Use forms and reports to display the data in a table to
users.
 

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