Conditional formatting error

  • Thread starter Thread starter danno-c
  • Start date Start date
D

danno-c

I have a form with multiple date fields, whenever the date entered is within
6 months of today's date, I have conditional formatting set to show the date
in red.

Taken From Dialog Box: "Field Value is - Less than - Date()-182.5"

There are instances where the formatting is being applied and others where
it is not. In some cases on the same form. I don't know where to go to get
the form code to past here so help there would also be appreciated.

Thanks,
Dan
 
Hi.

To get the code, open the form in design view, click on one of the date
fields, open the properties, look at the Event Properties. One of the events
should have [Event Procedure]. Click on the [...] at the end of the line and
that will take you to the code.

The code probably looks something like:

If me.fieldname < Date - 182.5 then
me.fieldname.ForeColor = "255"
End If

However, this is an assumption and I would need to see the actual code.

If you are using partial days (i.e. .5), that invokes the time of day. The
Date() function is usually used for the date alone. The .5 sets the time as
12:00. The Now() function contains the time of day as well as the date, so
the .5 will subtract 12 hours from the current time. Such a thing can make a
difference.
 
Back
Top