Connecting Tech Pros Worldwide Forums | Help | Site Map

need to copy a file from one location to another within access - ties up application

Member
 
Join Date: May 2007
Posts: 103
#1: Jan 14 '09
I support an access (2000) application. I have a request to copy this application to another location from within the application. I have used the the filescriptingobject fs.copyfile, it leaves the app open until the copy is complete. I also created a DOS .bat file to do the copy and I execute this from within the application but it also leaves the app open until the copy is complete. I can physically close the app, but the DOS window stays open. The app is large so it takes about 30 minutes to copy (with the fact that the servers are located elsewhere). I can not leave the app open while this copy takes place. I am running out of ideas... does anyone have any suggestions?
What I would really like is to be able to initiate the copy in the background so it can't be seen and be able to return to the form (where the cmdbutton was to initiate it) and have the user exit the application.
THanks!

NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,722
#2: Jan 15 '09

re: need to copy a file from one location to another within access - ties up application


The Shell() function works asynchronously. Would this resolve your problem?

A Cmd file (similar to .Bat) can be set up using PAUSE to allow you to continue only after the user has quit the db.
Member
 
Join Date: May 2007
Posts: 103
#3: Jan 15 '09

re: need to copy a file from one location to another within access - ties up application


Quote:

Originally Posted by NeoPa View Post

The Shell() function works asynchronously. Would this resolve your problem?

A Cmd file (similar to .Bat) can be set up using PAUSE to allow you to continue only after the user has quit the db.

Right now my 'Test.bat' file contains the following statements:
Expand|Select|Wrap|Line Numbers
  1. COPY C:\Testdb.mdb, T:\Testdb.mdb 
are you suggesting trying instead?
Call Shell(Test.bat)
Not sure I understand about the Cmd file. I have never used one before. Would the cmd file initiate the copying?
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,722
#4: Jan 15 '09

re: need to copy a file from one location to another within access - ties up application


Quote:

Originally Posted by ncsthbell View Post

Right now my 'Test.bat' file contains the following statements:

Expand|Select|Wrap|Line Numbers
  1. COPY C:\Testdb.mdb, T:\Testdb.mdb 

Firstly, I would remove the comma (,) from the command. That is incorrect syntax and may cause problems (May be an irrelevant typo of course too).
Quote:

Originally Posted by ncsthbell View Post

are you suggesting trying instead?

Expand|Select|Wrap|Line Numbers
  1. Call Shell(Test.bat)

Fundamentally yes.
Quote:

Originally Posted by ncsthbell View Post

Not sure I understand about the Cmd file. I have never used one before. Would the cmd file initiate the copying?

If, after fixing your .BAT file you were to rename it to Test.Cmd, then you could say instead :
Expand|Select|Wrap|Line Numbers
  1. Call Shell(Test.Cmd)
I would also consider adding PAUSE lines before and/or after the COPY to allow you to synchronise the copy after the database has been closed, as well as to allow you to see that it had completed ok.

Possibly something like :
Test.Cmd
Expand|Select|Wrap|Line Numbers
  1. PAUSE
  2. COPY C:\Testdb.mdb T:\Testdb.mdb
  3. PAUSE
Reply