Error on closing a form

G

Guest

Hello.
I have this antique problem in one of my forms.
I have a form based in a query. This query is based in two tables related
(the customers table, and the zip codes table).
The idea is that when I enter the zip code in the form, a field shows the
city automatically.
However, I have this problem: when I add a new record, and I close it
without filling the zip code field, appears a message with an error saying
that the application can not find the zip code in the zip codes table and
that the record cannot be saved in that time...
Is it possible to avoid that?
Thanks in advance...
Best regards.
Acores
 
R

ruralguy via AccessMonster.com

How about making sure a zip code has been entered before allowing the user to
save or close the form. It can be done in the BeforeUpdate event of the form.
 
G

Guest

Thanks, ruralguy, for your quick answer, but what if the user wants to simply
cancel the form? Now he just close the form with no filled fields, and the
error occurs...
Thanks again.

"ruralguy via AccessMonster.com" escreveu:
 
R

ruralguy via AccessMonster.com

You can either ask them if they want to cancel or provide a cancel button.
Me.UnDo will allow the form to close without creating a new record.
Thanks, ruralguy, for your quick answer, but what if the user wants to simply
cancel the form? Now he just close the form with no filled fields, and the
error occurs...
Thanks again.
How about making sure a zip code has been entered before allowing the user to
save or close the form. It can be done in the BeforeUpdate event of the form.
[quoted text clipped - 13 lines]
 
J

John W. Vinson

Thanks, ruralguy, for your quick answer, but what if the user wants to simply
cancel the form? Now he just close the form with no filled fields, and the
error occurs...

They can hit the <Esc> key twice to cancel the entire form addition.

John W. Vinson [MVP]
 

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

Top