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

x
?
Solved

How to close an access application from another access application?

Posted on 2012-08-27
4
Medium Priority
?
574 Views
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")
oAccess.Quit


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

Any thoughts?

Thanks in advance!
0
Comment
Question by:SeyerIT
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
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")
oAccess.Quit
0
 
LVL 77

Expert Comment

by:peter57r
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..
http://support.microsoft.com/kb/304408

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.
http://access.mvps.org/access/api/api0025.htm
0
 
LVL 2

Author Comment

by:SeyerIT
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.
0
 
LVL 2

Author Closing Comment

by:SeyerIT
ID: 38341039
That did the trick Capricorn!

Thanks
0

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