'FileCopy' Returns Error "File not found" for an existing file

marlan

Registered User.
Local time
Today, 05:10
Joined
Jan 19, 2010
Messages
414
Hi all you experts!

I have an Access system running in a client's location.
As part of an upgrade a few year ago, I have separated the front end to a few mdb files, Put them all in One netework directory, and added to the name of the main file a".2" suffix.
So the main file path is: "P:\MyNetworkDirectory\MyFileName.2.mdb

In order to have updated FEs on the users machine, there is a small app thet copies the above files to the local machine, and opens it:

Code:
Private Sub copyAndOpenMdbFile(FileName As String)
On Error GoTo Err_copyAndOpenMdbFile
    
    FileCopy "P:\MyNetworkDirectory\" & FileName, "C:\Temp\" & FileName
    
    dOpenFile.OpenFile "C:\Temp\" & FileName

Exit_copyAndOpenMdbFile:
    Exit Sub

Err_copyAndOpenMdbFile:
    MsgBox Err.Description
    Resume Exit_copyAndOpenMdbFile    
End Sub

I Send to copyAndOpenMdbFile() "MyFileName.2.mdb", the file is copied, and the copy is opened.

Now I have upgraded again, and have changed the file's name to "MyFileName.3.mdb" in the same directory. 'FileCopy' Returns Error "File not found"

could someone tell me what am I doing wrong?:banghead:
 
Double check your file name spelling. If it says it can't find it means it can't find it!

Also you would be much better off to use a UNC file path.

\\YourFileShare\MyNetworkDirectory\blahblah will always resolve if it exists on your network P: may not be mapped to the same place on another machine.

Finally MyFile . 2 . mdb - the use of two periods in the file name is messy, and could lead to some issues in certain circumstances.

Why not simply use MyFilename3.mdb ?
 
Have you tried to copy MyFileName.2.mdb today?
 
Double check your file name spelling. If it says it can't find it means it can't find it!
It seems as if there are some additional invisible characters...

Also you would be much better off to use a UNC file path.

\\YourFileShare\MyNetworkDirectory\blahblah will always resolve if it exists on your network P: may not be mapped to the same place on another machine.
'MyFile.2.mdb' works fine, so mapping is not the issue. I should use UNC file paths.

Finally MyFile . 2 . mdb - the use of two periods in the file name is messy, and could lead to some issues in certain circumstances.

Why not simply use MyFilename3.mdb ?
Could that be the issue?... could you please point out what would could be the issues and the circumstances? maybe some link or term to google?

Thank for your replies
 
I'm not sure how much of an issue it is these days, however this post https://superuser.com/questions/450603/should-file-names-contain-multiple-periods
has some good opinions on it none of which are very cut and dried except in saying "It shouldn't be an issue , but it could be..."

The fact that you have found some hidden characters may well be such an issue, maybe with a conventional file name the hidden characters would have been more obvious?
 
Double check your file name spelling. If it says it can't find it means it can't find it!

I have managed to delete a few 'invisible' characters prier to the file name, and it works now...

Thanks fot your support!
 

Users who are viewing this thread

Back
Top Bottom