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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top