Move file in Sharepoint from Access

K

Kaykayme

I am trying to move files from one folder to another on a Sharepoint drive
from Access. I was successful in exporting the report to a pdf file on the
Sharepoint drive. However, I want to move the old files to an archive folder
before exporting the new files monthly. The error I am running into is when
I use the scripting.filesystemobject move method, the destination path
includes \\ and I get an error message that the run-time error "Method 'Move'
of object 'IF'ile' failed" because of it. Is there some workaround since I
cannot use a mapped drive? I would have to make sure that this drive would
be mapped on every users computer.

Any help would be greatly appreciated.
 
J

Jack Leach

You can try the FileCopy() and Kill() functions to copy the file to a new
location, and then delete the original.


'=======
Dim sFile As String 'original path
Dim sCopy As String 'path of the copy

sFile = "\\SomeFolder\SomeFile.pdf"
sCopy = "\\SomeOtherFolder\SomeFile.pdf"

FileCopy sFile sCopy
DoEvents
Kill sFile
'==========

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
K

Kaykayme

Thanks! That worked!

Jack Leach said:
You can try the FileCopy() and Kill() functions to copy the file to a new
location, and then delete the original.


'=======
Dim sFile As String 'original path
Dim sCopy As String 'path of the copy

sFile = "\\SomeFolder\SomeFile.pdf"
sCopy = "\\SomeOtherFolder\SomeFile.pdf"

FileCopy sFile sCopy
DoEvents
Kill sFile
'==========

hth
--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 

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