best way to stop accidental deletes of data from field

Well, it depends on which object's "update" we're talking about. If you choose to perform your validation immediately after someone enters something in the control, then the control's AfterUpdate event is perfectly reasonable. (Which is what I think you were actually talking about in your earlier post). If you choose to perform your validation on the Form level, then the Form's BeforeUpdate is where you want to be...To me anyway.

It just depends on when you would rather do the validation. Which can depend on how complex the form is, how long it takes to fill out, and how "soon" you want your user to know that what they have entered is invalid.

For example, if I was filling out an sales Order form, and there was a zip/postal code field, and if it could be determined by code that the postal code I'd entered was a "we don't do business here" code, I'd like to know right away (!), before I take the trouble of filling out the whole thing - thus the control's AfterUpdate event might make perfect sense. Even if there is a slight duplication required by having to have it on the form's BeforeUpdate event as well. It all depends on timing, effort and business process how it will come across to the user whether validation failure messages can wait until the very end to show, or whether they'd benefit from showing earlier, too.

Adding one thing I have done in the past. When doing validation on numerous controls, in the form's BeforeUpdate event, changing the color (maybe to red) of any control that fails validation is a nice touch. Helps the user quickly spot problems, and aligns with behavior they're used to from webpages and other apps.
 
IMHO validation can be done in the Before Update event of a control as well but validation in the Update event of the form is a must.
 
Bob, I agree with you. The "must" is because the top priority must be making sure an invalid-filled out record is absolutely not allowed.
Then additional validations (such as those on Controls' events), might be warranted depending on how helpful it is to notify a user before waiting until the end.
 
Bob, I agree with you. The "must" is because the top priority must be making sure an invalid-filled out record is absolutely not allowed.
Then additional validations (such as those on Controls' events), might be warranted depending on how helpful it is to notify a user before waiting until the end.
Indeed :)
 

Users who are viewing this thread

Back
Top Bottom