Remote shutdown of a shared DB... (1 Viewer)

steve711

Registered User.
Local time
Yesterday, 21:04
Joined
Mar 25, 2004
Messages
166
On certain machines when the program is minimized it will not close them out, however on my machine it closes me out.

Any ideas?
 

GohDiamond

"Access- Imagineer that!"
Local time
Today, 00:04
Joined
Nov 1, 2006
Messages
550
Somebody wrote:
However, I don't think that the code is able to access the network because it acts as if the file for which it is checking isn't there or named incorrectly because it shuts the application down regardless of whether or not the file is named correctly. Otherwise, it works perfectly.

Sorry to post to such an old thread, but after reading it I thought I might try it out. The Code in the original post is from a microsoft help file "How to shut down a custom Access application remotely" http://support.microsoft.com/kb/304408

I ran into the same situation where no matter what I did the application would quit. There was some speculation that the information couldn't be read, but I found out, at least on my LAN, what the problem is with that directory

It should stop at the last folder and let the script peek inside to see what FILE is in that folder. Ergo the path should be
strFileName = Dir("YOURDRIVELETTER:\MainFolder\SubFolder\SUBSubFolder\")

The file in the final folder should be the ONLY ONE and it should be named
chkfile.ozx


The logical statement should then read
If strFileName <> "chkfile.ozx.txt" Then...

Because you followed instructions and created the empty file as a text file the extension .txt was appended but generally doesn't show, when you look at the file you see "chkfile". So one assumes that if one simply adds ".ozx" as instructed one will see "chkfile.ozx"; BUT the computer sees "chkfile.ozx.txt"

So unless you change the 'If' statement the answer will alway be incorrect and the application will always quit.

I was able to get it to work properly in this way, and wanted to share that.

I don't know if this knowledge is worth anything to anybody, but I wanted to get it on record in case I have to look it up again...

Cheers!
Goh
 

GohDiamond

"Access- Imagineer that!"
Local time
Today, 00:04
Joined
Nov 1, 2006
Messages
550
tada! here I am looking this up again. Thanks for savning it.
 

prabhus

Registered User.
Local time
Yesterday, 21:04
Joined
Mar 14, 2012
Messages
67
There is code that you can use to call a message box that will disapear after x number of seconds. I use the below code to do just that when I give the users a warning message that the application will shut down in 30 seconds. If the user clicks the OK button then the db shuts down right away, otherwise the message box will auto close in 30 seconds and then the db will shut down. It is nice to at least warn the users in the db with a message since you do not know which form they are in.

'Put this at the top of a public module [not a form module]
Code:
'Used with a timed message box
Public Property Get oMsgBox() As Object
    Set oMsgBox = CreateObject("WScript.Shell")
End Property
'Put this in your routine to force close the application
Code:
[COLOR=green]    'oMsgBox.PopUp "Testing...closing in ten seconds.", [COLOR=blue]10[/COLOR], "Force Closed", vbInformation[/COLOR]
    oMsgBox.PopUp "Your copy of the XXXX program will be closed in thirty seconds.  The data tables in the XXXX program are being updated or the XXXX program is being taken off line for maintenance.  You may try to open the XXXX program again in twenty minutes." & vbCrLf & vbLf & "Please contact XXXX if you continue to have problems opening the XXXX program.", 30, "Force Closed", vbInformation
    DoCmd.RunCommand acCmdExit

Hi ghudson,

thank you for this code, this code working for me except the force close
'oMsgBox.PopUp "Testing...closing in ten seconds.", 10, "Force Closed", vbInformation
oMsgBox.PopUp "Your copy of the XXXX program will be closed in thirty seconds. The data tables in the XXXX program are being updated or the XXXX program is being taken off line for maintenance. You may try to open the XXXX program again in twenty minutes." & vbCrLf & vbLf & "Please contact XXXX if you continue to have problems opening the XXXX program.", 30, "Force Closed", vbInformation
DoCmd.RunCommand acCmdExit
i was not clear when you routine, where should i exactly use this
 

Bucephalus

Registered User.
Local time
Today, 06:04
Joined
May 21, 2012
Messages
14
'Put this in your routine to force close the application
Code:
[COLOR=green]    'oMsgBox.PopUp "Testing...closing in ten seconds.", [COLOR=blue]10[/COLOR], "Force Closed", vbInformation[/COLOR]
    oMsgBox.PopUp "Your copy of the XXXX program will be closed in thirty seconds.  The data tables in the XXXX program are being updated or the XXXX program is being taken off line for maintenance.  You may try to open the XXXX program again in twenty minutes." & vbCrLf & vbLf & "Please contact XXXX if you continue to have problems opening the XXXX program.", 30, "Force Closed", vbInformation
    DoCmd.RunCommand acCmdExit
[/QUOTE]

Hello ghudson,

many thanks for this wonderful post, I used both of your codes and I get the pop up message but its not force closing after 30 seconds
any help? or suggestions ? :banghead:
 
Local time
Today, 09:34
Joined
Nov 22, 2019
Messages
31
Hi Guys,
I have an ask over here. How to shut down a custom Access application remotely with Timer on the form which will pop up to the user.
As we may have to perform maintenance tasks on a Microsoft Access database, such as compacting or repairing, making backup copies, or making design modifications. Many of these operations require that all users exit the database. However, there is no built-in way to force users to quit Microsoft Access. Your input is highly appreciated.

Rgds,
Akbar Alam
 

isladogs

MVP / VIP
Local time
Today, 05:04
Joined
Jan 14, 2017
Messages
18,209
I have a backend table called tblKickout with a boolean field Kickout.
The value of that field is monitored every 30 seconds.
When maintenance is required, the program admin sets Kickout = True and this starts a countdown procedure to forcibly close the frontends of all users of the application. I use a countdown time of 5 minutes but this can be altered.

As explained earlier in this thread by other members, I also use an idle time check to close apps where no activity has been detected in say 20 minutes.

Here's a link to a more recent thread with my solution and an example app so you can try it out

https://www.access-programmers.co.uk/forums/showpost.php?p=1546375&postcount=13
 

Users who are viewing this thread

Top Bottom