Unexpected/Misunderstood AfterUpdate Event Trigger

  • I have noticed that when a form initializes, if a textbox control's value is changed in the initialization procedure and that control immediately receives focus, that control's AfterUpdate event fires. However, if debugging is used to step through the initialization and activation of the form, the event does not fire. Why not? This behavior is not limited to the initialization procedure, but more generally applies any time a procedure modifies another textbox's value, and that textbox then receives focus via tab/enter or .SetFocus. Again, when stepping through the procedure, this behavior is not observed. Why not? Is there any way I can prevent this behavior?

    To duplicate: Create a user form with two textboxes. UserForm1 code:

    Showing this form causes TextBox1_AfterUpdate() to run, unless a breakpoint is placed in the UserForm_Initialize() procedure. Changing the tab order, or uncommenting TextBox2.SetFocus causes TextBox2_AfterUpdate()

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!