Form close error

G

Guest

Hello.
When I add a record, if I click in the form close button (the cross in the
upper right corner of the window), without fill anything, appears two
messages saying something about the related tables. Is it possible to avoid
this messages? Or maybe customise it?
Thanks in advance.
 
A

Allen Browne

The messages appear only if you have started creating a new record (or
editing an existing one), and the entry cannot be saved for some reason.

You get no warning unless both these conditions are true:
a) there is an edit in progress, and
b) the record cannot be saved.
The solution will therefore be to identify why these conditions occur, and
avoid them.

As an example, if you use the Current event of the form to set the value of
a bound control, you dirty the record as soon as you arrive there. This is
very bad practice, causing lots of unnecessary changes to the data, with
potential side effects. Similarly, if you use the AfterUpdate event of the
form to assign a value, you have dirtied the form again the instant is it
saved.

If you can track down when the form is being dirtied, you can prevent (a)
and so avoid the errors. To help you, make sure you have the form's Record
Selector property set to Yes. The icon in the record selector changes to a
pencil when you dirty the form, so this will help you pin down the point at
which this problem occurs.
 

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