confused about validation

A

Andre C

So I put the data validation code in the before update event of the
form.

I have a button on the form to close the window.

I click the close button, the validation routine tells me I forgot
something and then the form closes and does not give me chance to
retify the mistake.

Why?
 
J

Jeff L

Because your code runs when you close the form. If you don't want to
close the form, put your routine in the On Unload event instead. There
is a cancel setting that you can set to True, Cancel = True, if you
have validation "error" and your form will not close, allowing you to
fix whatever needs fixing.

Hope that helps!
 
Top