Triggering AfterUpdate Event

  • Thread starter Thread starter Ripan
  • Start date Start date
R

Ripan

I have a data entry form using forms and multipages with numerous dat
fields for the user to populate. I have also written error handlers t
restrict the input of the user using the AfterUpdate event (e.g. I
they enter an invalid entry for a date field and move off, th
AfterUpdate triggers an error message, which pops up next to th
field).

The general usage of this is that someone will open a new form, ente
data, and write to a worksheet. Since I do not allow invalid data to b
written, I can ensure that the data is correct when it is written, s
when I open the form, I do not need to validate anything.

However, in some cases, I may want to to import data from anothe
source, in which case, I would need to read in the data and validate.

However, since the error handlers run off the afterupdate event, usin
a macro to read in the data and populate the fields does not trigge
them. I thought I could bypass this problem by running a second macr
that uses SetFocus for each control to simulate moving off the control
However, this does not work also.

So after that explanation, my question is how I can trigger th
AfterUpdate events using VBA code
 
If you're loading a few textboxes(??) with data from somewhere else, I would
think it might be distracting to the user to tell them that what they just
entered isn't correct.

Maybe you could validate it when you're loading the form or maybe you could
validate it in the Ok/Continue button code???
 
Dave,

I agree 100%. That's why the error handlers I developed are in th
spirit of the Visual Studio .NET framework. I basically link an imag
file that sits next to each control which will appear on an error an
has the error message in the ControlTipText field. That way, the error
are unobtrusive but easily identifiable.

Given that Excel really doesn't have anything like that that I coul
find, it was worth the extra effort to have that working.

In any case, I found a way to work around triggering the after updat
event. I basically temporary change the value in the control and chang
it back, then move focus to something else. That triggers the event
and pops up any detected errors.

Thanks for your help.

Ripa
 
Back
Top