Lmv,
If you are using the Conditional Formatting approach, you can set a
condition using...
'Expression is...' [YourControl] Is Null
.... and set up the colour accordingly.
If you are using the code approach, as suggested by Wayne:
If Me.ControlName = "(000) 000-0000" Then
Me.ControlName.BackColor = vbRed
ElseIf IsNull(Me.ControlName) Then
Me.ControlName.BackColor = vbYellow
Else
Me.ControlName.BackColor = vbWhite
End If
However, I wouldn't expect the Exit event of the form would be correct.
I mean, after you exit the form, you can't see it, so it doesn't
matter what clour it is! Nor would I use the form's Load event as
suggested by Wayne either. I think you would need the code on the
Current event of the form, and also the After Update event of the control.
Myself, I would use Conditional Formatting.
By the way, in this context the meaning is clear, but please note that
forms do not have fields. Fields are in tables and queries, and the
field values are displayed on forms via controls. Probably a good idea
to get in the habit of using 'control' as it can be confusing otherwise
in other contexts.
--
Steve Schapel, Microsoft Access MVP
Thanks I thought I had tried that but like you said extra ) in the format was
the problem. One more question is there a way to set the field to a different
color if it has "no value" as you exit the form if they have missed a field
using what you have below? How do I tell it to look at certain fields? Or
should I post this as a different question? Like how do you set missed
required fields to a diffent color and pop up a msg? <grin>
Thanks!!