Unexpected closure (1 Viewer)

Gismo

Registered User.
Local time
Today, 23:24
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:24
Joined
Oct 29, 2018
Messages
21,358
Have you tried importing all your objects into a new database?
 

Gismo

Registered User.
Local time
Today, 23:24
Joined
Jun 12, 2017
Messages
1,298
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
 

isladogs

MVP / VIP
Local time
Today, 21:24
Joined
Jan 14, 2017
Messages
18,186
That's not what I'm suggesting. Please read the article.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:24
Joined
Feb 19, 2002
Messages
42,976
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.
 

Isaac

Lifelong Learner
Local time
Today, 14:24
Joined
Mar 14, 2017
Messages
8,738
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"
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:24
Joined
Feb 28, 2001
Messages
27,001
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.
 

Isaac

Lifelong Learner
Local time
Today, 14:24
Joined
Mar 14, 2017
Messages
8,738
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

Top Bottom