Validating data before form closes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a tab control that contains several subforms. I've already put code
on the beforeupdate to each subform to make sure that certain fields are not
left blank. Unfortunately, if I edit the data (ie delete required value) and
click on the form's close button (X) or close from menu it allows me to
close. I still get the validity messages but the form will still close. I've
tried data on unload but I haven't gotten it to work. Any suggestions what
code to put on the unload event? Thanks!
 
Na rijp beraad schreef VBAgroupie :
I have a tab control that contains several subforms. I've already put code
on the beforeupdate to each subform to make sure that certain fields are not
left blank. Unfortunately, if I edit the data (ie delete required value) and
click on the form's close button (X) or close from menu it allows me to
close. I still get the validity messages but the form will still close. I've
tried data on unload but I haven't gotten it to work. Any suggestions what
code to put on the unload event? Thanks!

You can set Cancel to True in the unload of the form. However, that
means your validations must set a boolean to determine if any
validation fails.
 
Back
Top