filecopy

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This fails with a path or access 75

FileCopy "c:\crisnet\export\active.dbf",
"c:\crisnet\export\CMA_Toolkit_Data\CMA_ACT.dbf"

The CMA_Toolkit_Data folder exists and this statement works on another
machine. I have been able to save to c:\crisnet\export only so I know that
the source part is working.
 
You don't mention whether you write to the destination folder though.

Try copying the below code into a module. Run the Sub Test and paste
back the debug results.

Sub Test()

fncFileAccessTest "c:\temp\crap.txt"
fcnFileAccessTest "c:\crisnet\export\CMA_ACT.dbf"
fcnFileAccessTest "c:\crisnet\export\CMA_Toolkit_Data\CMA_ACT.dbf"

End Sub
Function fcnFileAccessTest(myPath As String)

Dim myFolder As String
Dim myFile As String
Dim F As Integer

myFolder = Left$(myPath, InStrRev(myPath, "\") - 1)
myFile = Mid$(myPath, InStrRev(myPath, "\") + 1)

Debug.Print "Testing for " & myPath
Debug.Print " Folder " & IIf(Dir(myFolder, vbDirectory) _
= "", "does not exist", "exists")
Debug.Print " File " & IIf(Dir(myFolder & "\" _
& myFile) = "", "does not exist", "exists")
F = FreeFile
Err.Clear
On Error Resume Next
Open myFolder & "\temp.tmp" For Output As #F
Debug.Print " You do " & IIf(Err.Number = 0, "", "NOT ") _
& "have write rights to this folder"
Kill (myFolder & "\temp.tmp")
Close #F

On Error GoTo 0

End Function
 

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

Back
Top