Form closing problems

N

Neil

Hello All,

I have a problem with Access 2002. In the BeforeUpdate event of my form, I
have a procedure which loops through all the controls on my form. If any
fields that are required are left blank, I cancel the event and bring up
another form which displays the reason why the event was cancelled and gives
the user an option to undo or return to the main form and continue. This
works great until the user clicks on the close button in the main form. I
then get the Access DataErr 2169

Microsoft Access

You can't save this record at this time.

Microsoft Access may have encountered and error while trying to save a
record.
If you close this object now, the changes you made will be lost.
Do you want to close the object anyway?

Yes No

The form that I open has the functionality of this message box (and gives a
better description of what is wrong and how to correct it) and I would like
to display that instead. I have tried coding the Form_Unload event to do
this but the message box above appears before the Unload event executes. I
have also tried coding the Form_Error event to catch this error and try to
supress the message but can't seem to get that to work either. Does anyone
have any sugestions as to how I can get this to work properly?

TIA,

Neil.
 
J

Jeff Boyce

Neil

Is there a chance you don't open the pop-up message form in "dialog" mode?
It sounds a little like the user can still see the main form's <Close>
button, and can still select it.

Perhaps trying to close a main form (and save a record) when the
BeforeUpdate code is still running (i.e., the pop-up isn't closed yet) is
causing your problem?
 
N

Neil

Thanks for your input Jeff,

The form is Modal but can't be set to dialog. There is an option frame on
how to proceed and an OK button. If the form is dialog then the user cant
change anything in the option frame. Maybe my only work around is to replace
the option frame with command buttons.

Thanks,

Neil.
 

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