Solved

File copy error 75

Posted on 2000-04-17
12
359 Views
Last Modified: 2010-08-05
I am having problems copying a file locally.  What happens is, we have a piece of software which creates the JRN files in the CashDir.  It copies files to the ServerFile.  This copies OK but when it copies it from the CashDir to LocalDir it fails.  To put these variable names into context, the ServerFile is a directory on a server and the CashDir is, as I said, a local location where the file resides until this code is run.  The LocalDir is also a local directory which is a subfolder of CashDir.


Private Sub Timer1_Timer()

Dim JRNFile As String, ServerFile As String, Log As String, Destination As String

On Error GoTo ErrorHandler

'Label1 = Counter

If Counter <> 60 Then    ' SET BACK TO 60
    Counter = Counter + 1
    Exit Sub
End If

Counter = 1

File = LocalDir & "\" & "Backup.log"
Open File For Append As #2

'Download updates from server - **NOT CURRENTLY USED**

'File = UpdateDir & "/*"
'UpdFile = Dir(File)

'Do While UpdFile <> ""
'    ServerFile = UpdateDir & "/" & UpdFile
'    LocalFile = Updates & "/" & UpdFile
'    FileCopy ServerFile, LocalFile
'    Log = UpdFile & " updated " & Now
'    Print #2, Log
'    UpdFile = Dir
'Loop

'Get the journal files one by one and if they are not todays files
'then copy them to the server and to the save directory then
'delete the origninals.  All this is logged in Backup.log

File = CashDir & "\*.JRN"
JRNFile = Dir(File)

'Label2 = "Transferring ..."
DoEvents

Do While JRNFile <> ""
    If JRNFile <> TodaysFile Then
        Print #2, "Copying " & JRNFile
        Infile = CashDir & "\" & JRNFile
        ServerFile = ServerDir & "\" & Position & "\" & JRNFile
        Localfile = LocalDir & "\" & JRNFile
        Destination = ServerFile
        FileCopy Infile, ServerFile
        Log = JRNFile & " copied to server at " & Now
        Print #2, Log
        FileCopy Infile, Localfile 'Fails here
        Log = JRNFile & " copied locally at " & Now
        Print #2, Log
        Kill Infile
        Log = JRNFile & " deleted at " & Now
        Print #2, Log
    End If
    JRNFile = Dir
Loop

'Label2 = ""

AfterError:

Close #2

On Error GoTo 0

Exit Sub

ErrorHandler:

Print #2, "Encounter Error" & Err

If (Err = 75) Or (Err = 76) Or (Err = 52) Then
    Log = "Failed to copy to " & Destination & " at " & Now
    Print #2, Log
    'Label2 = "Failed " & Err
    Resume AfterError
Else
    Log = "Error " & ErrCode & " occured at " & Now
    Print #2, Log
    End
    'Label2 = "Failed " & Err
End If

End Sub

I have tried recreating the exe and installing it again.
0
Comment
Question by:andcu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 

Author Comment

by:andcu
ID: 2723092
It would be useful to know that the filenames are made up from the physical position of the PC in this case 03 and then the date they were produced so.  If the file was created on the 10/04/2000 at computer 03 then the name would be 03100400.jrn
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2723143
andcu, is there any possibility that localfile is open in another process? Or that if it is an NT box that there are permissions set which prevent the user accessing the folder?
0
 
LVL 32

Expert Comment

by:Brendt Hess
ID: 2723474
My best bet is that LocalDir is either access protected, or the Variable name is formed incorrectly.  

Check the permissions on the LocalDir directory, and ensure that the variable LocalDir doesn't have a terminal backslash - FileCopy doesn't like names like 'C:\Logs\History\\03100400.log'
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 32

Expert Comment

by:Brendt Hess
ID: 2723536
My best bet is that LocalDir is either access protected, or the Variable name is formed incorrectly.  

Check the permissions on the LocalDir directory, and ensure that the variable LocalDir doesn't have a terminal backslash - FileCopy doesn't like names like 'C:\Logs\History\\03100400.log'
0
 

Author Comment

by:andcu
ID: 2725763
I think the answers are no because:

1) The client machine is Windows 95.

2) It can be copied manually
0
 
LVL 32

Expert Comment

by:Brendt Hess
ID: 2727405
But what is the actual value in the variable LocalDir?
0
 

Author Comment

by:andcu
ID: 2746631
LocalDir = c:\cashr\audit
cashdir = c:\cashr
0
 
LVL 32

Expert Comment

by:Brendt Hess
ID: 2748366
This is a long shot, but try setting the Localfile variable manually, e.g.

  Localfile = "c:\cashr\audit\" & JRNFile

Does this work?
0
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 200 total points
ID: 2748446
One other long shot, based on a vaguely remembered problem some years back:  Open your log file on a differently numbered channel.  Try #9.  If I recall correctly, the Filecopy uses a channel as well, and it may be conflicting.

0
 

Author Comment

by:andcu
ID: 2750517
All I can say is it worked.

I don't know about the other idea of hardcoding "c:\cashr\audit" because I didn't try it so apologies if your answer would have worked too.
0
 

Author Comment

by:andcu
ID: 2750525
Ahh!

That was lucky, I have just realised that both these suggestions came from you, bhess1.  That was lucky means you can have points for your time aswell as for your correct answer.
0
 
LVL 32

Expert Comment

by:Brendt Hess
ID: 2751749
No problem - just glad I remembered the situation where that happened to me!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month5 days, 1 hour left to enroll

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question