Copy a network file and paste locally using a Macro

  • Thread starter Thread starter Presto
  • Start date Start date
P

Presto

Access 2003 macro nubie here.

I have to copy two files from a network location. Both are Access Databases
that need to be stored locally,
then run one of them.

It is currently done via a DOS batch file called by a macro, but I feel this
is a bit clumbsy.(the fewer files the better)
I would like to be able to do this directly within the macro.

So in a nutshell :
1. Copy \\networkpath\mydatabasefile1.mdb and paste to c:\pcdata
2. Copy \\networkpath\mydatabasefile2.mdb and paste to c:\pcdata
3. Run c:\pcdata\mydatabasefile1.mdb

Thanks in advance for your assistance.
 
Presto,

No, you can't do file amnipulations with macros. You will need to use a VBA
procedure. The syntax would be:
FileCopy "\\networkpath\mydatabasefile1.mdb" "C:\pcdata\mydatabasefile1.mdb"
Application.FollowHyperlink "C:\pcdata\mydatabasefile1.mdb"
 
Presto said:
Access 2003 macro nubie here.

I have to copy two files from a network location. Both are Access
Databases that need to be stored locally,
then run one of them.

It is currently done via a DOS batch file called by a macro, but I feel
this is a bit clumbsy.(the fewer files the better)
I would like to be able to do this directly within the macro.

So in a nutshell :
1. Copy \\networkpath\mydatabasefile1.mdb and paste to c:\pcdata
2. Copy \\networkpath\mydatabasefile2.mdb and paste to c:\pcdata
3. Run c:\pcdata\mydatabasefile1.mdb

Are you willing to try/use code in place of a macro?

The vba code to do the above is:


FileCopy "\\networkpath\mydatabasefile1.mdb",
"c:\pcdata\mydatabasefile1.mdb"
FileCopy "\\networkpath\mydatabasefile2.mdb",
"c:\pcdata\mydatabasefile2.mdb"
Application.FollowHyperlink "c:\pcdata\mydatabasefile1.mdb"
 
Back
Top