Checking Control Value before Display

  • Thread starter Thread starter Chaplain Doug
  • Start date Start date
C

Chaplain Doug

As I bring up each record in my form, I want to check the
control ENTERDATE (which has source field ENTERDATE) to
see if it falls outside a range. I then want to set the
forecolor to red if it does. I know how set set the
forecolor. I am having a hard time figuring out how to
check the value for each record in the form as it is being
painted (i.e., when I open the form). Thanks for your
help. God bless.
 
First, your control name and field name are the same. There are times that
this can cause you problems. See the naming conventions here:
http://www.mvps.org/access/general/gen0012.htm

You don't mention your version of Access. If using Access 2000 or newer,
right click the control in design mode and choose Conditional Formatting. If
using an older version, check the value of the control in the Form's Current
event and the control's AfterUpdate event and adjust the forecolor using
code.
 
Cool! I am using Access 2002. I may not need to know
but . . . where is this conditional formatting being
done? It seems like it paints my whole continuous form
(many records) and then changes the colors in the text
boxes based on the conditional formatting. Just what I
needed. Thanks.
 
Back
Top