Unexpected closure

Gismo

Registered User.
Local time
Today, 02:42
Joined
Jun 12, 2017
Messages
1,298
Hi all,

My one DB will just close unexpectedly without warning and a backup opens

How do I trouble shoot the reason for this?
I do my compact and repair often as well as debug
 
Have you tried importing all your objects into a new database?
 
Have you tried importing all your objects into a new database?
Hi,

yes I did that, quite a while ago, still had the same issue
I noticed that when it closed, the response was very slow in opening any form
 
That's not what I'm suggesting. Please read the article.
 
If you are using an .accde/.accdr and you don't have error trapping, Access simply closes the database. If you are using an .mdb or .accdb, see if you can remember what you were doing when the closure happens. If you can identify the form, you can put error trapping code in any modules that have code and that should get you started. When I don't know what errors I might expect, I use a generic message that shows me the code as well as the description.


Private Sub somename
On Error GoTo ErrProc
'''' your code

ExitProc:
Exit Sub
ErrProc:
Select Case Err.Number
Case Else
msgbox Err.Number & "--" & Err.Description
End Select
Resume ExitProc
End Sub



Sorry about the code. I get an error when I use the code window to post it.
 
But Pat it does usually give that ugly "execution of this application can't continue and will be shut down" error. (doesn't it? it's been too long since I had untrapped runtime errors for me to know, but it used to). I haven't seen it shut down just silently (at least, not due to that scenario - untrapped error in runtime). In that case, as Chevelle says, "Closure will come"
 
There are two ways to look at this, not necessarily mutually exclusive.

Either you can add code to report an error OR you can check the event viewer to see if Access reports an error in the system error logs. As "must shut down" class of error USUALLY does that.
 
I want to add some thoughts due to things I have seen (in person at my jobs) of people doing that are totally outside the bounds of what VBA and Access (or even Excel) expect, and can cause ALL kinds of corruption issues.

- Failure to follow this simple sequence, ALL the time:
  1. Do some development/design work
  2. Debug > Compile
  3. Save
  4. Use the application
- Failure to follow this simple sequence all the time:
  1. You're in break mode - do not edit any code!
  2. Get out of break mode (by pressing Stop, or passing an Exit)
  3. Proceed.
Not following those sequences can just bring the VBA project into a state of total chaos IMHO.

I've seen people who are over a year into VBA development/learning and they are still trying to do things like editing code in break mode or fully deploying and utilizing totally uncompiled applications. In my experience, doing either of those is asking for trouble. The latter there may be some special circumstances that may warrant, but I haven't come across them yet.
 

Users who are viewing this thread

Back
Top Bottom