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