Help!!!Closing a Form with 2 Subforms Without Saving any Information

wjoc1

Registered User.
Local time
Today, 19:21
Joined
Jul 25, 2002
Messages
117
I have a form that contains 2 subforms. I have a save button for the purposes of saving any information entered. What I'm worried about is a user entering an incomplete record, deciding they don't want to enter any more information and hitting the x or closing the form. What I have then is a incomplete record saved.

I was hoping to have a button that closed the form without saving any information entered. I have been using a button with an undo command followed by a DoCmd.Close to this end which works fine BUT.

This won't work when the main form is empty and someone has enterd information into the subform. I get an error message :

You cannot add or change a record because a related record is required in table CUSTOMERS

Obvious enough error message, the problem is that when I click ok the form still doesn't close. In fact it just returns me to the form.

Now if I have the exact same scenario and I click the x on the window or go to File => Close I get the same error message but when I click ok I get a second error message:

You can't save a record at this time
If you close this object now, the data changes you made will be lost. Do you want to close the database object anyway?

Now when I click ok I exit and the record isn't saved. This suits me fine and I would be quite happy with this scenario but why don't I get the same second error message when I use my button

Can someone please please help me or offer an alternative. This is driving me nuts!

Liam
 

Users who are viewing this thread

Back
Top Bottom