Solved

Access won't close after writing to external tables

Posted on 2000-04-17
16
652 Views
Last Modified: 2012-06-27
My application will not close after doing some updates to tables in another Access database file using Recordsets.  I am closing recordsets and setting them = Nothing, I am closing database and setting = Nothing.

My mdb (or mde) is unloaded, but msaccess.exe will not quit.  I have to kill the process in NT Task Manger.  I am not using workspaces.

Anybody seen this?
0
Comment
Question by:KMAN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 2
  • +1
16 Comments
 
LVL 3

Expert Comment

by:MikeRenz
ID: 2724486
make sure that you are up to date with all of your mdac and dcom updates.

I get this problem when using poorly (In my opinion) made component which handles scanning images and storing the objects.  Check 'everywhere' to make sure you aren't leaving any recordsets open.  Other than that, check you updates and service packs.  If this all fails...another form of attack is always creating a new mdb and importing all objects from the old mdb.  Compact, compact, compact!!!
0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2724523
I was able to get an application like that to close by changing all references to fields in recordsets from the form

    <RecSet>.<field>  

to

    <RecSet>!<field>


Additionally, that app had made all calls to Subs in the form

    SubName(Arg)


I changed all of these to the form

    SubName Arg

Doing those two things cause the app to close normally.

Brian
0
 
LVL 10

Expert Comment

by:paasky
ID: 2725409
Hello KMAN,

Many people participating EE have had this nasty problem. Here are useful links you find information for the bug and instructions how to fix your database to prevent the problem:

http://www.mvps.org/access/bugs/bugs0005.htm

http://support.microsoft.com/support/kb/articles/q190/0/74.asp

Regards,
Paasky

0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 5

Author Comment

by:KMAN
ID: 2727988
OK - I have changed my boolean IF's so they are explicit, no help.  Recordsets are all closed and destroyed as is the DAO reference to the external MDB file.

No improvements.

I do deploy as MDE with Runtime, when I 'Exit' in this case (.mde /Runtime), I actually get a Run-Time error dialog that reads:
"Execution of this application has stopped due to a run-time error.  The application can't continue nd will be shut down."

Thanks, KMAN
0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2728765
Try this:

Close in the way that won't.
Restore the app so that you can get to the DB window.
Click on the Modules tab, and open any module for design.
If "Debug|Show Next Statement" is available, click it.

It's a shot in the dark, but I'm thinking that there might be some halted code waiting...
0
 
LVL 5

Author Comment

by:KMAN
ID: 2730769
Actually the app is closed, just Access itself won't close.
0
 
LVL 10

Expert Comment

by:paasky
ID: 2731016
KMAN,

Here's *dirty* method to close your application and Access:

Private Declare Function apiPostMessage Lib "user32" _
        Alias "PostMessageA" _
        (ByVal hwnd As Long, _
        ByVal wMsg As Long, _
        ByVal wParam As Long, _
        lParam As Any) _
        As Long
       
Public Sub CloseAccess()
Dim RetVal As Long
    RetVal = apiPostMessage(hWndAccessApp, &H10, vbNull, vbNull)
End Sub

Paasky
0
 
LVL 5

Author Comment

by:KMAN
ID: 2731509
Paasky -

I put this code in a module and call the sub from my Exit button (in place of DoCmd.Quit), but to no avail.  Access still won't close.

Thanks for trying.
0
 
LVL 10

Accepted Solution

by:
paasky earned 100 total points
ID: 2731599
Okay, more rude method is required.. try change &H10 (=Close) to &H2 (=Destroy)

If that doesn't help, then we need TerminateProcess API..

Paasky
0
 
LVL 5

Author Comment

by:KMAN
ID: 2731622
I prefer KILL to destroy, but either way it works.  Thanks!

What are my possible side effects of using this technique?
0
 
LVL 10

Expert Comment

by:paasky
ID: 2731657
Are you using linked tables or are tables in same project?

You should ensure that all table transactions are finished. Access DB is binary file so interrupted actions may cause problems.
0
 
LVL 5

Author Comment

by:KMAN
ID: 2731759
Only linked tables and Pass-Through queries.  I don't use transactions so I guess I'm OK there.
0
 
LVL 10

Expert Comment

by:paasky
ID: 2731891
OK. Happy I could help you to find work-around for this problem.

Best regards,
Paasky
0
 
LVL 5

Author Comment

by:KMAN
ID: 2731909
I spoke too soon.  This method gives Dr. Watson every time when compiled as MDE and opened with /Runtime option.  Back to the drawing board.

The log gives Fault Info:
function: LszFromIdz
        3001b8fb 6a00             push    0x0
        3001b8fd 8bd6             mov     edx,esi
        3001b8ff e806000000       call    LszFromIdz+0x1c6b (3001b90a)
        3001b904 5f               pop     edi
        3001b905 5e               pop     esi
        3001b906 c9               leave
        3001b907 c20c00           ret     0xc
        3001b90a 83ec0c           sub     esp,0xc
        3001b90d 53               push    ebx
        3001b90e 55               push    ebp
FAULT ->3001b90f 8b5a04           mov     ebx,[edx+0x4]          ds:09c5f3d6=????????
        3001b912 56               push    esi
        3001b913 57               push    edi
        3001b914 8b7c2420         mov     edi,[esp+0x20]         ss:0174e6ab=????????
        3001b918 33ed             xor     ebp,ebp
        3001b91a 8bf1             mov     esi,ecx
        3001b91c 3bfd             cmp     edi,ebp
        3001b91e 89742418         mov     [esp+0x18],esi         ss:0174e6ab=????????
        3001b922 896c2410         mov     [esp+0x10],ebp         ss:0174e6ab=????????
        3001b926 7506             jnz     LszFromIdz+0x1c8f (3001b92e)
        3001b928 8b3dd4ac2930     mov     edi,[3029acd4]         ds:3029acd4=00000000
        3001b92e 57               push    edi


0
 
LVL 10

Expert Comment

by:paasky
ID: 2732026
I'm sorry to hear this. hmmm.. runtime/MDE seems to work differently as I can see.. How about making external program with VB/C++/Delphi/SomeOtherTool? that is launched just before you close the application which will wait <x> seconds and then kills Access window?

I also saw suggestion that there are MS Access analyzer tools which could help you to check your code. See http://www1.experts-exchange.com/Computers/Databases/Access/Q_10330602.html

Paasky
0
 
LVL 5

Author Comment

by:KMAN
ID: 2732270
Low and behold, there was a little itty-bitty DAO database not being destroyed.  Found it, coded it...problem gone.

This was a valuable lesson none-the-less.

Thanks for all the help.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question