[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How to close an access application from another access application?

Posted on 2012-08-27
Medium Priority
Last Modified: 2012-08-28
Any idea how I could code shutting down another access application from a different access application?

I found some code that looks like this:
Dim oAccess As Object
Set oAccess = CreateObject("Notify - Copy.accdb")

When I run this though it sets oAccess = Nothing when it hits that second line.

Any thoughts?

Thanks in advance!
Question by:SeyerIT
  • 2
LVL 120

Accepted Solution

Rey Obrero (Capricorn1) earned 2000 total points
ID: 38338400
try using the GetObject instead of createObject

Dim oAccess As Object
Set oAccess = GetObject(completePathToDB &"\Notify - Copy.accdb")
LVL 77

Expert Comment

ID: 38339847
As far as I know, if you didn't open the database through automation, then you won't be able to close it .

To force a close programmatically, the app to be closed has to be looking for a 'message' to tell it to close. It does that through a form running a timer that checks for the presence or absence of a known file.
If the file is present, the timer procedure closes the app.

See here for an example..

Other than that, then closing an application is a O/S level action and requires Windows APIs to do it.
There is some code here, although I 've never tried to used this method on an Access app.

Author Comment

ID: 38340529
Thanks Guys,

Capricorn thanks for that, I'll give that a try.

Peter, I'm actually doing something very similar to what you are mentioning. I actually have a hidden accessdb running in the backround at all times that acts as a messaging service as well as a method of controlling the other applications they may be running.

So whenever I send the notify form a message it checks to see if it is a shutdown command and then will follow the code, which is where I want to try and tell it to close a specific application (another Access db) on there computer.

I actually already put some code into the Other access applications that is also looking at the notifications table to see if there is a launch message sent so that the other applications can restart the hidden notify form if need be. So I guess in theory it could check to also see if it is a shutdown command and if so then just close itself.

Author Closing Comment

ID: 38341039
That did the trick Capricorn!


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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 …
Suggested Courses

872 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