FileCopy

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I'm using a FileCopy command in a form to copy my database to another name,
and I'm getting a "Permission denied" error. There are no permission
problems, although the file was open at the time. Is this why I'm getting
the error? What can I do to create a copy of a database, even if it's
open/busy?

Chris
 
It is seldom good practice to copy an open file - whether it is a database
file, or any other kind of file. The file system might have pending changes
which have not been written to the file yet. Pending changes are flushed
when the file is closed. It is really only safe to copy a file when it is

HTH,
TC
 
I am using filecopy to copy some word documents - backup
a file before editing (using VBA from the database). I
am getting an error that the file was not found. A
search is performed prior to the statement confirming
both the location and existance of the file. So, I am
guessing that the reference is to the destination...
which, shouldn't exist!

Here is my code:
'sets up file to be copied to the backup directory
strOrig = ROOT_PATH & strPath
strOrig = strOrig & strName
strBackFile = strName & " " & strRevision
strBackup = ROOT_PATH & "backup\" & strBackFile
FileCopy strOrig, strBackup
 
If the file copy fails with file not found, the file identified in strOrig
does not exist. Add the following line before the filecopy:

debug.print "1>"; strrig; "<"
debug.print "2>"; dir$(strorig); "<"

The 1 output shows exactly what is in that string. The 2 output will be
blank if that file doesn't exist. The ><'s are so you can easily see any
leading or trailing blanks in the values.

HTH,
TC
 
Back
Top