Access 2016 Processes not being killed during Automation but same works for Access 2013/10/07

Vipul Bhojwani
Vipul Bhojwani used Ask the Experts™
on
We have an Access Automation Software where we are opening up an instance of MS Access 2016 using COM and fetching some data of tables/reports etc from the Access Database.
Once done, we close the MS Access Database by -

1. Calling Database.Close()
2. Assigning null value to the referenced variables
3. Calling CloseCurrentDatabase() of the Access Application Object
4. Finally Calling Quit() method of the Access Application Object
5. Assigning null value to the Access Application referenced variables
6. Calling GC.Collect() & GC.WaitForPendingFinalizers() in a separate thread.

Doing all of the above kills MS Access 2013 instances but fails to do so for MS Access 2016.
The processes linger on for some time and keep consuming ~50 MB RAM and ~10% CPU even though our automation is completed and our code has quit. We find that these processes get killed some time later.

This lingering on of processes is causing High CPU / RAM usage issues as we sometimes find more than 50 instances open.

Is there any known issue in MS Access 2016 while closing or does it connect to post activity (like connect to some server and send data) when its Application.Quit is called.

Would appreciate some advice in this regards.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
No known issues at the moment that I'm aware of.   But with that said, throughout the years, bugs in Access has prevented shutdowns when calling Access via automation.

 The last one I remember was a bug in a evaluating a true / false expression when used in a subform.  If the expression was:

If <condition> then

rather then:

If <condition> = true then

 You would get a hang.

  The only things I would offer are:

1. Make sure your fully patched up on the Access install.

2. Carefully review any VBA code and make sure you are closing any object you open and setting all object variables your using to nothing.

Jim.
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
and note the work around would be to kill the process if left running, but that can be a problem security setting wise.

Jim.
Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Commented:
Are you doing this via Windows Task Scheduler? or is it being called from some other software application?
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
Top Expert 2015

Commented:
hi Vipul

what about adding
DoEvents
after everything?
( could can think of DoEvents as "do it now")

sometimes you need to DoEvents multiple times ... maybe 3x in a row -- see if one does the trick first ;) ~

if that does not help, would you please post the code for the object variable DIM statements, and the code being used to cleanup and release the object variables? thanks

have an awesome day,
crystal
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
Try using DoCmd.Quit   rather than Application.Quit.

 Should not make a difference, but the shutdown process is different.

Jim.
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
Top Expert 2015

Commented:
Jim, what are the differences between DoCmd.Quit  and Application.Quit?  I generally use Application. Although I do not set Compact on Close, I have read it only fires with DoCmd which, for me, is a reason not to use it.

Vipul, depending on what the code is doing, perhaps Sleep is needed to make sure all processes are done before closing and releasing? If that is not it, perhaps there is a recordset or other object variable that needs cleaning up first?

have an awesome day,
crystal

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial