0
votes

I have an Access 2007 database with a date field on a form. This field is the contact start date for an employee. Example: 16-May-05

I would like this field to display red text on the contract start date month + one month.

So in this example, "16-May-05" on "1 June (every year)" to "30 June (every year)" the field would display red text.

1
What kind of form - datasheet, continuous, single form? Have you looked at Conditional Formatting? - Fionnuala
I'm not 100% sure I know the answer to that question but after some Googleing I think I'm using a single form. Is there anything thing I can do to verify this? - James
"Have you looked at Conditional Formatting?" I had a look at Conditional Formatting earlier but I'm not sure how I would create the statement. Any ideas? Sorry, Im not really an access dev. Thanks for your assistance. - James
A single form displays one record, the Format tab of the Property Sheet will show the default view. A whole lot of answers depend on the type of form, so it is essential you find out this kind of information before asking questions. - Fionnuala

1 Answers

0
votes

In a single form, you can use the Current Event of the form to set the back ground colour and the various font properties.

Private Sub Form_Current()

If Me.ADate > #1/1/2011# And Me.ADate < #1/31/2012# Then
    Me.ADate.BackColor = vbRed
Else
    Me.ADate.BackColor = vbWhite
End If

End Sub

You may also wish to add code to the After Update event.