Cancel On Current when Closing

CCIDBMNG

Registered User.
Local time
Today, 11:45
Joined
Jan 25, 2002
Messages
154
I have code in the Form_Current that is apparently running when I close the database. Is there anyway to stop this code from running if that database is closing?

Thanks in advance for any help.
 
Actually it only happens when closing the entire database, it doesn't occur when just closing the form. Is there anyway to prevent this?
 
Is the issue that you' re letting the user close/exit the database before they close the form?
 
Last edited:
Yes, I have a button on the form which closes everything.

The issue is that I have code in the form_current which requeries a couple listboxes based on what's on the form. When you exit the database from the form, it runs through the code but the form is closed so it's prompting for the fields on the form.

I tried saying if the value is null not to do it but it doesn't work. If I add a break in the code on the IF statement, it brings up the code but never breaks and does close the database without issues.
 
I have seen this before.

What version of Access , including the SP number, as you using?
 
Last edited:
but never breaks
Have you unchecked the USE ACCESS SPECIAL KEYS checkbox in the Startup Options? If so, you can set a breakpoint but it will never break. If you have unchecked the box, you'll need to check it again so you can use a breakpoint for debugging.
 
SOS - Yes the Use Access Special Keys is checked.

HiTechCoach - It's 2007 SP2

I was actually able to stop this by creating a variable that is loaded on Form Load that loads False and then loads True when the click the Exit button. I'm then checking if the variable = False on my form_current.

Thanks for helping though, I appreciate it.
 

Users who are viewing this thread

Back
Top Bottom