Copy a network file and paste locally using a Macro


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.
 
Ad

Advertisements

S

Steve Schapel

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"
 
Ad

Advertisements

A

Albert D. Kallal

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"
 

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