Control Display Characteristics

  • Thread starter Thread starter Mary
  • Start date Start date
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
 
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
 
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.
 
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
 
Back
Top