Re: copy files between drives from within access 2003
- From: Krazy Darcy <KrazyDarcy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 23 Jun 2007 12:00:00 -0700
Thanks.
I'm getting no error messages now. And when I added "Call" to the line in
the code it changed from red to black.
It didn't seem to be doing anything so I removed the "vbhide" which ment a
command line window opened when I pushed the button. I can see why it still
isn't working - just a case of adding a switch ot two for xcopy. I have a
printout of the switches (via xcopy /? > xcopy.txt then print it out).
I should have the switches sorted tonight (NZST) after work. I'll post back
then as to how it goes.
Thanks for your time.
"Douglas J. Steele" wrote:
Shell is a function. When you use a function, you either need to assign its.
value to a variable:
Dim lngReturn As Long
lngReturn = Shell("xcopy c:\dw\*.* H:\Dw /E", vbHide)
or, since you don't really care about what value it returns, Call the
function:
Call Shell("xcopy c:\dw\*.* H:\Dw /E", vbHide)
Another alternative is just to leave out the parentheses:
Shell "xcopy c:\dw\*.* H:\Dw /E", vbHide
but I personally prefer the Call syntax, as it makes it clearer that an
external routine is involved.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Krazy Darcy" <KrazyDarcy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C717B06B-0930-4543-9A15-FEC724E57A6D@xxxxxxxxxxxxxxxx
Thanks.
Here is what I have at the moment
Private Sub Command1_Click()
On Error GoTo Err_Command1_Click
Shell("xcopy c:\dw\*.* H:\Dw /E", vbHide)
Exit_Command1_Click:
Exit Sub
Err_Command1_Click:
MsgBox Err.description
Resume Exit_Command1_Click
End Sub
I get a "Compile Error Syntax error" message when I click on the button
on
the test form I am using to test it.
Also as soon as I finished typing the shell line I got a error message -
"Compile Error Expected "=" "
I havn't added the /d switch at the moment but added the /e switch (I
printed the xcopy /? output for referance) which tells it to copy
subdirectories
Thanks .
"NthDegree via AccessMonster.com" wrote:
Darcy,
Add a command button to your form but don't take any of the options when
if
prompts you, just click Finish.
Right click on the button and select Build Event.
It will open the VBA code window with the start and end of a procedure
and it
should look something like this:
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
After the "On Error statementment add this (or whatever you need):
Shell("xcopy c:\atempdir\*.* c:\dlink /D", vbHide)
The /D will only copy files from atempdir to dlink that don't exist in
the
dlink folder or that have a newer date than the matching file name.
Save the form, click on the button. There are a dozen or so more
parameters
for the xcopy command that can further refine what you need to do, just
run a
cmd window and type in help xcopy.
Krazy Darcy wrote:
I have just go a external hard drive and want to have a button in my
Access
2003 switchboard (or a button on a form) that does the following:
copy files from c:\dw\ to n:\dw
if the file allready exists then overwrite if file on c: modofied more
recently than on H:
I don't know the first thing about vb/vba so I need some instructions
for
dummies level help here.
I plan to have several buttons some will only backup a folder (and it's
sub
folders)while one would back up several differant folders (and their sub
folders...)
Thank you for any assistance.
--
Never let it be said that I was totally comitted to sanity. It is the
dark
places of my mind that fascinate me.
NthDegree
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200706/1
- References:
- Re: copy files between drives from within access 2003
- From: NthDegree via AccessMonster.com
- Re: copy files between drives from within access 2003
- From: Krazy Darcy
- Re: copy files between drives from within access 2003
- From: Douglas J. Steele
- Re: copy files between drives from within access 2003
- Prev by Date: Re: Access Web Application
- Next by Date: Re: Can Access 2007 develop a 2003 app to run on access 2003 runtime
- Previous by thread: Re: copy files between drives from within access 2003
- Next by thread: Auto Debugging/Stop with Access 2003?
- Index(es):