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

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.
 
M

Marshall Barton

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.
 

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