• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 982
  • Last Modified:

Path/File access error nr 75


How can I avoid getting error 'Path/File access error nr 75'?

I want to move & rename certain file. For the moment I am using the command 'Name source as target' where source and target represent a different path & file name. Most of the time this is working fine, but sometimes I'm getting above mentioned error.
Now I have seen during debug that 'Name' is substituted with the formname ... ? Is this the reason why I get the error ?
Can anybody give me a hint how to avoid this error ?

I am running VB 5.0 on Windows NT 4.0


1 Solution
Target file may be locked (opened) or marked readonly at certain times ?
can you show us some code ?
yeah ,

some code , and "is the only thing you want is to get rid of the error?"

If the file you want to rename is locked and readonly, I think the error should occur.
However, you can capture the error using Error handling.

public sub RenameFile()
On Error resume next
       Name <Source> as <Target>
       if dir$(Target) <> "" then
            'do what you want
       end if
end sub

By checking if the target exists, you will know that the Name method is success
or not.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Into my application when I recieve error 75, it means the file is already opened by another application. If you recieve the error, wait some seconds and try again.
PolvdvAuthor Commented:
To Filip :

Waiting does not solve the problem.
Sometimes I can solve the problem by simply editing the input file (via FoxPro editor), but this doesn't work always. Sometimes I get message 'Acces denied' and
in those cases I have to reboot my PC before being able to continue processing.

To Iexpert :

Target file is always new file, so it can not be locked or marked read-only

To all :

I also think the source file is locked in some cases for some unknown reason (source file is created by PC3270 print session with data coming from MVS mainframe)

Maybe it is sufficient to unlock the input file before trying to rename it ? Because I am not a VB expert I do not know how to do this.

We had a similar problem with a simple copy - sometimes it seems that the Windows filesystem is "locking" the file... This is what we did and we never had the problem since:

On Error Resume Next
FileCopy sOrigFile, sTargetFile
If Err.Number <> 0 Then
   i = 0
      Sleep (250)
      FileCopy sOrigFile, sTargetFile
      i = i + 1
   Loop Until Err.Number = 0 Or i > 3
End If
If Err.Number <> 0 Then
   MsgBox "A copy error occurred: " & Err.Description
End If

I think you should use some sort of retry-mechanism also.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now