Resetting Control Background Colors after an Undo Event

C

Chris Windsor

How would you do this:

You have a form that when loaded, the background colors of all the empty
controls (e.g. textboxes and comboboxes) are yellow (to alert the user that
they are empty). After entering data into a control, it turns white (this I
have working). Exercise an Undo event (e.g. pressing the Esc key), the
dirty controls should go back to their empty state and the background colors
change back to yellow. Everything I've tried leaves the background color of
the empty controls white.

Chris
 
A

Allen Browne

In the form's Undo event, examine the OldValue of the control, e.g.:
Me.Text0.BackColor = IIf(IsNull(Me.Text0.OldValue), vbYellow, vbWhite)
 
C

Chris

Perfect... many thanks Allen

Chris

Allen Browne said:
In the form's Undo event, examine the OldValue of the control, e.g.:
Me.Text0.BackColor = IIf(IsNull(Me.Text0.OldValue), vbYellow, vbWhite)
 

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