Log in

View Full Version : After Update Event



jediderek
06-29-2017, 07:07 AM
I was wondering if there was a way to to trigger an after update event on any Control that was Selected. For example: All I would want to do is if a Control has a value changed by a user(after update event) I want the background Color of the Control to change. But lets say I have over a 100 Controls. I find it annoying that I would have to go through and add that modification to each "After Update Event" for each Control. There must be an easier way where you can past Control by reference.

OBP
06-29-2017, 07:27 AM
The form itself has a Before and After Update Event, so if you used the Before Update you can identify the field that currently has "Focus" using the ActiveControl attribute.
Like
msgbox Me.ActiveControl.Name gives the name of the control.

OBP
06-29-2017, 07:33 AM
.

jediderek
06-30-2017, 07:05 AM
That I did not know about and I'm glad I know that know for the future stuff, but sadly after fooling around with it for about an hour, I'm just going to have to go through and create an event for every Control...Thanks!

OBP
06-30-2017, 07:17 AM
What sort of code did you try?
As this works
Me.ActiveControl.BackColor = vbRed
Changes the colour of the current active control.

jediderek
07-03-2017, 11:48 AM
I could not get it to work the way I wanted, So I just spent 30min going through 270 controls adding an after update event to change the color, wasn't fun haha