Closing DOS window


M

Mark

Hi,

On a local machine, Win98, Access97, Pkzip (DOS ver), I have a command
button which zips a database onto a floppy. Could someone please tell me
what I need to add in order to automatically close the DOS window after
Pkzip performs the zipping process? TIA.

P.S. The code was given to me by someone else. What is the purpose of the
line: "DoCmd.Close"? -- Pkzip gives a warning that the file can't be opened
if I comment this line out.

What I have so far is:

Private Sub Command55_Click()

Dim zipname, cmdstring, foo

zipname = "fpsdata" & ".zip"

cmdstring = "C:\pkzip\pkzip -xc:\access97 a:\" & zipname _
& " c:\access97\fpsdata.mdb"
DoCmd.Close

foo = Shell(cmdstring, 1)

End Sub
 
Ad

Advertisements

M

Mark

additional comment:

I noticed in the Help file for Shell the following:

"Note The Shell function runs other programs asynchronously. This means
that a program started with Shell might not finish executing before the
statements following the Shell function are executed."

-- I know that I want to send "exit" to the dos window, but since Pkzip
takes a few seconds to execute, I suspect that any command that I send to
close the dos window (even if I knew the syntax on how to do that) would
arrive before Pkzip had finished processing. Is there a way to accomplish
this automatically, or do I simply allow the user to manually close the dos
window? Thank you.
 
Ad

Advertisements

M

Mark

(I may be just talking to myself here, but ...)

I noticed that when Pkzip finishes, the dos window is still open, but I'm
not actually at the command prompt -- so, typing (or sending) "exit" isn't
appropriate. Alt-F4, however, does work -- i.e., closing the dos window.

I quess I could add a SendKeys command (Alt-F4) to my code, but I understand
that this command is not reliable and would probably turn off NumLock.
Also, I still have the problem of timing that command in relation to whether
Pkzip has finished its processing.
 

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