Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileCopy statement, Error "Path not found"

Status
Not open for further replies.

ksee2033

Technical User
Feb 13, 2004
5
US
Hello all,
I'm very new to VB, and am basically teaching it to myself, so please be patient!

I am trying to use the CopyFile statment to copy a file using vb on an asp webpage, but I keep getting a "Path not found" error. As far as I know, the path is correct...here is my code:

<%
'Practice try at backing up files automatically
Set oFileSysObj = CreateObject("Scripting.FileSystemObject")

oFileSysObj.CopyFile "H:\repair\Results.mdb", "\\lnac10\svol002\Commons\AllAccess\Repair\Results.mdb", TRUE
Set oFileSysObj = nothing
%>

If there is anything apparently wrong with this code, please let me know! Thanks in advance.
 
The file probably doesn't exist. Check to see if the file exists before moving it.

'Practice try at backing up files automatically
Dim oFileSysObj As FileSystemObject
Set oFileSysObj = CreateObject("Scripting.FileSystemObject")
If oFileSysObj.FileExists("H:\repair\Results.mdb") Then
oFileSysObj.CopyFile "H:\repair\Results.mdb", "\\lnac10\svol002\Commons\AllAccess\Repair\Results.mdb", True
Else
MsgBox "File does not exist!", vbCritical
End If
Set oFileSysObj = Nothing

Swi
 
Also you don't need to specify the MDB name in the destination. You can just use:

\\lnac10\svol002\Commons\AllAccess\Repair
Just to make sure both the file and folder exist you could try this as well:

'Practice try at backing up files automatically
Dim oFileSysObj As FileSystemObject
Set oFileSysObj = CreateObject("Scripting.FileSystemObject")
If oFileSysObj.FileExists("H:\repair\Results.mdb") And _
oFileSysObj.FolderExists("\\lnac10\svol002\Commons\AllAccess\Repair\") Then
oFileSysObj.CopyFile "H:\repair\Results.mdb", "\\lnac10\svol002\Commons\AllAccess\Repair\", True
Else
MsgBox "File does not exist!", vbCritical
End If
Set oFileSysObj = Nothing

Swi
 
Hmm...not sure what permissions are set incorrectly, but when I run your code, I get a "Permission denied: 'MsgBox'"
error...any thoughts?
 
Are you sure you have access to the folder where you are copying the mdb? You may want to ask you network administrator.

Swi
 
It's possible that I don't...I will check into that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top