Close Command File

llkhoutx

Registered User.
Local time
Today, 16:45
Joined
Feb 26, 2001
Messages
4,018
I use a batch file containing an Access command line which executes the correct version of MS Access, specifies the password mdv, and the front-end mdb.

Under Win 98/ME this batch file closes following its execution. Under XP it remains open until the Access program is closed.

How can I close it following its execution?

Thank you in advance for your help. :cool:
 
Last edited:
Why use a batch file at all and not simply a shortcut? this can do the same but does not need an "open window" to execute and stuff....

Regards
 
I use a command line because it does more that just execute the program, it (1) specifies the path to the version of Access I'm using as I have several versions are installed, (2) specifies the path to the security file, and (3) executes the program. A mere shortcut won't do all that.
 
I got the same problem 2 years ago. I did not expect that solution will be so simple:
Right-mouse click on your .bat file, find property and just select(check) "close on exit" checkbox. THAT IS IT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Igor.
 
llkhoutx said:
I use a command line because it does more that just execute the program, it (1) specifies the path to the version of Access I'm using as I have several versions are installed, (2) specifies the path to the security file, and (3) executes the program. A mere shortcut won't do all that.
A shortcut is ALL THAT. try it, just paste the full command line into a shortcut and find that it does work (you may need to add some " " if you have spaces anywhere in your path)
 
I pasted my command line into the "Target" field of my shortcuts properties window and it works like a 98/ME batch file. Your solution is great.

I recently started using Windows XP, finally joining the 21st century.

Thank you for your help. :cool:
 
I hate to say I told you so but.....

Told ya so! :D
 
For future reference, Exit or Quit (I forgot which) might do the trick.

Also, rather than using DOS .bat files, you can use Windows Scripting Host (or something like that). It's the batch file version of VB. It uses untyped variables and shares many commands with VB/VBA. It is part of Windows 2000 and newer, and should already be installed.

You can use it by creating text files and running them or from within Access. However if you run the procedures from within Access, you'll either need to turn Option Explicit off or declare all variables.

Here's a simple example that creates a desktop shortcut to the calculator. You could use something similar to create a shortcut to your db. You can then ship the text file to the users and tell them to run it.

Code:
'*** WSH026a.VBS        FB20010515
' Create a Desktop Shortcut to MS Calculator

Set WShell = CreateObject("Wscript.Shell")
UsrDesktop = WShell.SpecialFolders("Desktop")

Set sLink = WShell.CreateShortcut(UsrDesktop & "\Calculator.lnk")
sLink.TargetPath = "%systemroot%\System32\calc.exe"
sLink.Save
 
Pat -

Neither Exit, Not Quit closes the Bat file (command line) executed via a shortcur in XP. I just ried both.

It wouild be nice to be able to have the same solution for XP & 98/ME. :mad:
 
I don't know that VBScript doesn't work in earlier versions. It simply came on my horizon with A2K and I don't have an older operating system to experiment with.
 
The shortcut solution should work in any windows version ( I think )

Regards
 

Users who are viewing this thread

Back
Top Bottom