-
FileCopy Mystery
My application has 14 mdb files and I am writing a backup routine. Using filecopy,sourcefile,destinationfile in the routine. 13 of the files copy and on one I get the error message "permission denied".
I have checked for any differences in file structure and attributes, none. Have gone to DOS and copied. Copied the file to a different name and then copied back with no difference in result.
Any thoughts on what could be happening?
Thanks again, and again to all you experts.
-
Could it be in use by another program?
-
Response
-
One thought one question.
Question: Can you copy the database from one place to another using the standard copy from Windows Explorer?
Thought: Try using VB's SetAttr to ensure the Db's propertys are set only to Archive.
-
Reply
If I eliminate the FileExists call then the file will copy.
If FileExists("cdata.mdb") Then
frmBusiness.txtBusinessName = frmCompany.txtCompany
End If
Public Function FileExists(ByVal FileName As String) As Boolean
FileExists = ((Len(FileName) > 0) And (Len(Dir$(FileName)) > 0))
End Function
There is a data control on frmCompany using cdata.mdb.
If this action opens the file, how do I close.
Thanks.
-
Here's another method that you could use. :cool:
Dim F As File, FSO As New FileSystemObject
Dim S as string
S = "C:\Test.txt"
If FSO.FileExists(S) Then
Set F = FSO.GetFile(S)
F.Copy "C:\CopyTest.txt", True
End If
-
Try again
My question was, "if the following opens the file, how do I close"
frmBusiness.txtBusinessName = frmCompany.txtCompany
(frmCompany has a data control tied to cdata.mdb)