Killing the running Access application

  • Thread starter nigelb via AccessMonster.com
  • Start date
N

nigelb via AccessMonster.com

Ok, this might sound like a very strange question... and I know this may
raise a curious eyebrow or two... but I´ll try to explain why I need this
solution at the end for those that are curious to know.

But... is there a way to kill the same Access application that is running at
the moment the application quits?

Now, to satisfy any curiousity... the reason being is that I have created an
Access "install" application that installs a series of files (including the
main Access application) and makes a few registry entries onto the user´s PC.
The intension of this "install" application is once-only by nature, so once
it has finished it´s job I would prefer to clean up by having it remove
itself from the user´s system.

This may sound like an odd thing, and I´m aware that an Access application
may have problems killing itself given that it has to run "kill" execution
code while still in memory... (how can it kill itself?) but it´s worth a shot.
 
M

Michel Walsh

You can run the installation script from a DVD, so there is no need to
delete it

You can run the installation inside a script (batch file, kind of file
executable at command prompt, and having some file capability ) with code
like:



myInstallation.exe ' which creates a file toto.mdb
delete c:\toto.mdb



so on completion, the file will be deleted. Sure, if something wrong occurs
and the installation 'freeze' , you may be left with the file toto.mdb
still present.

http://www.amazon.com/Microsoft®-Wi...=sr_1_1?ie=UTF8&s=books&qid=1222375640&sr=8-1
can be nice if you plan to use line commands somehow intensively.



Vanderghast, Access MVP
 
N

nigelb via AccessMonster.com

Thanks for that, I´ll try that and see how it goes.

Michel said:
You can run the installation script from a DVD, so there is no need to
delete it

You can run the installation inside a script (batch file, kind of file
executable at command prompt, and having some file capability ) with code
like:

myInstallation.exe ' which creates a file toto.mdb
delete c:\toto.mdb

so on completion, the file will be deleted. Sure, if something wrong occurs
and the installation 'freeze' , you may be left with the file toto.mdb
still present.

http://www.amazon.com/Microsoft®-Wi...=sr_1_1?ie=UTF8&s=books&qid=1222375640&sr=8-1
can be nice if you plan to use line commands somehow intensively.

Vanderghast, Access MVP
Ok, this might sound like a very strange question... and I know this may
raise a curious eyebrow or two... but I´ll try to explain why I need this
[quoted text clipped - 19 lines]
code while still in memory... (how can it kill itself?) but it´s worth a
shot.
 
N

nigelb via AccessMonster.com

Thanks Michel, I could do this, but I´d really prefer to use an Access app as
the installer (that way it tests that the user has Access installed in the
first place) and I can present graphical screens, and transfer data from an
older version of the main Access application to the updated one, and then it
can easily launch the updated main Access application that it installs
directly afterwards (once the installer kills itself that is... well, if it´s
possible...?) So... without needing to use like a batch file script, can I
get an Access application to kill itself in code itself when it´s quiting?
(Back in the BASIC programming language days I know this could be done)



Michel said:
You can run the installation script from a DVD, so there is no need to
delete it

You can run the installation inside a script (batch file, kind of file
executable at command prompt, and having some file capability ) with code
like:

myInstallation.exe ' which creates a file toto.mdb
delete c:\toto.mdb

so on completion, the file will be deleted. Sure, if something wrong occurs
and the installation 'freeze' , you may be left with the file toto.mdb
still present.

http://www.amazon.com/Microsoft®-Wi...=sr_1_1?ie=UTF8&s=books&qid=1222375640&sr=8-1
can be nice if you plan to use line commands somehow intensively.

Vanderghast, Access MVP
Ok, this might sound like a very strange question... and I know this may
raise a curious eyebrow or two... but I´ll try to explain why I need this
[quoted text clipped - 19 lines]
code while still in memory... (how can it kill itself?) but it´s worth a
shot.
 
M

Michel Walsh

The operating system don't let you delete a file "in-use", at least, not at
the application level. Since you 'mdb' file is in use, you won't be able to
delete it as long as it is 'in use'.

You can still use an MS Access application within a script:

install.bat
----------------
MSACCESS.exe yourInstallingApplication.mdb
Delete SomeOfYourInstallingApplication.mdb



It is only two lines, the first one starting access, which does the
installation as you want, and, when access terminates, the second line of
the script is executed, while the file to be deleted is not in-use anymore.


Vanderghast, Access MVP


nigelb via AccessMonster.com said:
Thanks Michel, I could do this, but I´d really prefer to use an Access app
as
the installer (that way it tests that the user has Access installed in the
first place) and I can present graphical screens, and transfer data from
an
older version of the main Access application to the updated one, and then
it
can easily launch the updated main Access application that it installs
directly afterwards (once the installer kills itself that is... well, if
it´s
possible...?) So... without needing to use like a batch file script, can I
get an Access application to kill itself in code itself when it´s quiting?
(Back in the BASIC programming language days I know this could be done)



Michel said:
You can run the installation script from a DVD, so there is no need to
delete it

You can run the installation inside a script (batch file, kind of file
executable at command prompt, and having some file capability ) with code
like:

myInstallation.exe ' which creates a file toto.mdb
delete c:\toto.mdb

so on completion, the file will be deleted. Sure, if something wrong
occurs
and the installation 'freeze' , you may be left with the file toto.mdb
still present.

http://www.amazon.com/Microsoft®-Wi...=sr_1_1?ie=UTF8&s=books&qid=1222375640&sr=8-1
can be nice if you plan to use line commands somehow intensively.

Vanderghast, Access MVP
Ok, this might sound like a very strange question... and I know this may
raise a curious eyebrow or two... but I´ll try to explain why I need
this
[quoted text clipped - 19 lines]
code while still in memory... (how can it kill itself?) but it´s worth a
shot.
 
N

nigelb via AccessMonster.com

Yes of course, you´re right, that´s a perfect way to do it. So the "delete"
command line in the batch file doesn´t execute until MyInstallingApplication.
mdb file is quit, is that right?

Thanks, I´ll make use of this straight away.


Michel said:
The operating system don't let you delete a file "in-use", at least, not at
the application level. Since you 'mdb' file is in use, you won't be able to
delete it as long as it is 'in use'.

You can still use an MS Access application within a script:

install.bat
----------------
MSACCESS.exe yourInstallingApplication.mdb
Delete SomeOfYourInstallingApplication.mdb

It is only two lines, the first one starting access, which does the
installation as you want, and, when access terminates, the second line of
the script is executed, while the file to be deleted is not in-use anymore.

Vanderghast, Access MVP
Thanks Michel, I could do this, but I´d really prefer to use an Access app
as
[quoted text clipped - 36 lines]
 
N

nigelb via AccessMonster.com

Hmmmm... when I run the batch file it says "msaccess.exe is not a recognized
command or filename".


Michel said:
The operating system don't let you delete a file "in-use", at least, not at
the application level. Since you 'mdb' file is in use, you won't be able to
delete it as long as it is 'in use'.

You can still use an MS Access application within a script:

install.bat
----------------
MSACCESS.exe yourInstallingApplication.mdb
Delete SomeOfYourInstallingApplication.mdb

It is only two lines, the first one starting access, which does the
installation as you want, and, when access terminates, the second line of
the script is executed, while the file to be deleted is not in-use anymore.

Vanderghast, Access MVP
Thanks Michel, I could do this, but I´d really prefer to use an Access app
as
[quoted text clipped - 36 lines]
 
M

Michel Walsh

you have to specify the full path for that file, and of the mdb file as
well. Well, your are NOT obliged if the path is already included in the PATH
"OS"-variable, but if you don't have any real use outside that
functionality, preferable to use the full path name for the implied files.
Be careful if the path implies blanks in its name:


"C:\Program Files\Microsoft Office\Office11\MSAccess.exe" "C:\Program
Files\Microsoft Office\Office11\Samples\Northwind.mdb"


as example, because of the space in the folder name: Program Files



Vanderghast, Access MVP



nigelb via AccessMonster.com said:
Hmmmm... when I run the batch file it says "msaccess.exe is not a
recognized
command or filename".


Michel said:
The operating system don't let you delete a file "in-use", at least, not
at
the application level. Since you 'mdb' file is in use, you won't be able
to
delete it as long as it is 'in use'.

You can still use an MS Access application within a script:

install.bat
----------------
MSACCESS.exe yourInstallingApplication.mdb
Delete SomeOfYourInstallingApplication.mdb

It is only two lines, the first one starting access, which does the
installation as you want, and, when access terminates, the second line of
the script is executed, while the file to be deleted is not in-use
anymore.

Vanderghast, Access MVP
Thanks Michel, I could do this, but I´d really prefer to use an Access
app
as
[quoted text clipped - 36 lines]
code while still in memory... (how can it kill itself?) but it´s worth
a
shot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top