Control Display Characteristics

M

Mary

What is the appropriate code for the following scenario?
I would like to set the BorderColor and ForeColor
properties to red dependent upon whether text is entered
into a control source. If the control source is null,
there would be no format changes.

Thank you. Mary
 
J

JohnWL

Using VBA code in the After Update event of the control similar to the
following should do the trick:

Private Sub txtYourControl_AfterUpdate()
If IsNull(txtYourControl) then
txtYourControl.ForeColor = 0 'Black
txtYourControl.BorderColor = 0
Else
txtYourControl.ForeColor = 255 'Red
txtYourControl.BorderColor = 255
End If
End Sub
 
M

Mary

How do I limit the format changes to just one record? And
for them to remain with that record once the file is
closed? Thank you.
 
P

Pavel Romashkin

There is not way other than conditional formatting to do what you want
in Continuous forms.
Conditional formatting will be applied by Access any time you open your
form, so in a way it is "saved" whan you close your file.
Pavel
 

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