Canceling Close (1 Viewer)

JamesJoey

Registered User.
Local time
Today, 12:26
Joined
Dec 6, 2010
Messages
608
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?"
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:26
Joined
Feb 19, 2002
Messages
43,776
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.
 

JamesJoey

Registered User.
Local time
Today, 12:26
Joined
Dec 6, 2010
Messages
608
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
 

JamesJoey

Registered User.
Local time
Today, 12:26
Joined
Dec 6, 2010
Messages
608
I created a new form and pasted the code but got the same results.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:26
Joined
Feb 19, 2002
Messages
43,776
It works perfectly for me.

Make sure you apply any pending updates.
 

JamesJoey

Registered User.
Local time
Today, 12:26
Joined
Dec 6, 2010
Messages
608
No pending updates.

Maybe I'll just go with "My" way, I don't get any error messages.
 

spikepl

Eledittingent Beliped
Local time
Today, 18:26
Joined
Nov 3, 2010
Messages
6,142
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

  • PreventClose2.zip
    28.9 KB · Views: 97

JamesJoey

Registered User.
Local time
Today, 12:26
Joined
Dec 6, 2010
Messages
608
Works fine now. I got to the point I did find the error number but wasn't sure how to apply it.

Thanks,
james
 

JamesJoey

Registered User.
Local time
Today, 12:26
Joined
Dec 6, 2010
Messages
608
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
 

RickRo

Registered User.
Local time
Today, 09:26
Joined
Mar 16, 2013
Messages
18
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!
 

Gina

Registered User.
Local time
Today, 12:26
Joined
Apr 15, 2000
Messages
30
Public bPreventClose as Boolean should be placed at the top of the module, NOT inside of a function.
 

Users who are viewing this thread

Top Bottom