TextBox Before and After update Events - what if filled from cmdBt

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

A text box control's before and after update events trigger all well when
data is entered directly from keyboard. If the text box's value is filled
from a cmdbtn such as a 'Search' Button that pops up a form and returns value
to the text box, the events are not triggered. Or, am I missing something out
here ?

Thanks.
 
Sreedhar said:
A text box control's before and after update events trigger all well when
data is entered directly from keyboard. If the text box's value is filled
from a cmdbtn such as a 'Search' Button that pops up a form and returns value
to the text box, the events are not triggered. Or, am I missing something out
here ?


That is correct. Many events are not triggered when you use
VBA code to set a control's Value. This is generally a good
thing as you do not want you code triggering a cascade of
other events.

If you really need the AfterUpdate event to fire, then just
call it in you button's procedure:
textbox_AfterUpdate

In other cases, you are probably better off creating a
separate Sub of Function procedure to do whatever checking
you need and call that from both the button's procedure and
from the text box's event procedure.
 
Back
Top