
AfterUpdate event - determining button clicked
On Mon, 28 Jul 1997 22:51:03 -0500, "Dominic J. Koorie"
Quote:
>I have a UserForm with a number of textboxes. Per my users' request, as
>they enter data in a textbox and then move on (either by tab or mouse
>click), they want the data to be validated. This is easy - I use an
>AfterUpdate event. However, if the button clicked is the Cancel button,
>then I do not want to perform the validation for that textbox.
>Is there a way to easily determine which button has been clicked inside
>of an AfterUpdate event? I realize that there is a Click event for the
>Cancel button but it does not fire until after the AfterUpdate event.
I haven't tried this, but how about putting an
Application.OnTime Now, "'CheckABox " & Me.ActiveControl.Name & "'"
in the testbox AfterUpdate handler.
This should result in CheckABox being run after any other pending
events.
Then the Cancel button handler could set a global flag before
CheckABox ran and CheckABox could test that flag and only proceed with
the validation if cancel had not been used.
Let us know if it works.
Bill Manville
Oxford, England
Microsoft Excel - MVP