Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access won't close after writing to external tables

Posted on 2000-04-17
16
Medium Priority
?
664 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
  • 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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 400 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

810 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