Canceling Close

Now when I click either the No or the Cancel I get the following:

Code:
"You can't save this record at this time.
'mydatabasename' may have encountered an error while trying to save a record.
If you this object now, changes you made will be lost.
Do you want to close the database object anyway?"
 
Are you sure you have only one instance of the app open? Please post the database. Either the form is corrupt or there is code that is causing a problem.
 
I guess if I breath wrong on my Access db the forms get corrupt.
I only have 1 instance of the db open.
Here is a ZIP of the form and table.

View attachment PreventClose.zip
 
I created a new form and pasted the code but got the same results.
 
It works perfectly for me.

Make sure you apply any pending updates.
 
No pending updates.

Maybe I'll just go with "My" way, I don't get any error messages.
 
When I try it reacts like you say in #21.

Have tinkered a bit - see if you like this one better. Don't know why it does an Undo, when you press Cancel, but...
 

Attachments

Works fine now. I got to the point I did find the error number but wasn't sure how to apply it.

Thanks,
james
 
Just wanted to say that everything is working great. I've been wanting to apply this for some time but never got around to it.
I want to say thanks to all.
Especially Pat Hartman for the assistance.

Thanks much,
James
 
I was referred over to this thread - I have one question. Where does this go:
Code:
Public bPreventClose As Boolean

I think it would go to a a new module, but I cant seem to get it. When I add it by itself I get an error, if I add is as a sub I get an error, if I add it as a function I get an error.

Thanks!
 
Public bPreventClose as Boolean should be placed at the top of the module, NOT inside of a function.
 

Users who are viewing this thread

Back
Top Bottom