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

Debug: Path/File access error (Error 75)

Hello ~

I am receiving a "Path/File access error (Error 75)" on the line:

            Kill Me.ImageAddress

in the piece of code below.  By debug.print 'Me.ImageAddress': K:\Access Database\Pictures_Assigned2006\30-34028-S2-301.jpg

it IS correct and the file IS there.

I'd appreciate your ideas on how to correct this.

Thank you, Jacob



If Me.ImageAddress <> "K:\Access Database\Images\NoImage.bmp" Then
 
            ' Removes image from file
            Debug.Print Me.ImageAddress
            Kill Me.ImageAddress
            Me.ImageAddress = Null
            Me.Requery
            MsgBox "Image deleted."
 
        End If

Open in new window

0
Chi Is Current
Asked:
Chi Is Current
  • 4
  • 3
1 Solution
 
DhaestCommented:
Probably there is a file lock on this file, which means that another process, program is still using this file.
0
 
Chi Is CurrentAuthor Commented:
Dhaest ~ Thank you for your reply.

Hmmmmmm an interesting idea.  I'm not seeing how this could be possible though.  The entire procedure is below.

Is there a way I can check?

Jacob
Private Sub cmdDeleteImage_Click()
'On Error GoTo Err_cmdDeleteImage_Click
'Deletes SPEC Image
    Dim strPath As String
 
    strPath = "K:\Access Database\Images\NoImage.bmp"
 
 
    If MsgBox("You are about to delete this image. Are you sure?", vbYesNo) = vbNo Then
        Exit Sub
    End If
 
 
    If IsNull(Me.ImageAddress) = False Then
        If Me.ImageAddress <> "K:\Access Database\Images\NoImage.bmp" Then
 
            ' Removes image from file
            Debug.Print Me.ImageAddress
            Kill Me.ImageAddress
            Me.ImageAddress = Null
            Me.Requery
            MsgBox "Image deleted."
 
        End If
    End If
    
Exit_cmdDeleteImage_Click:
    Exit Sub
 
Err_cmdDeleteImage_Click:
    MsgBox Err.Description
    Resume Exit_cmdDeleteImage_Click
 
 
End Sub

Open in new window

0
 
DhaestCommented:
Perhaps you should try to switch these 2 lines
            Kill Me.ImageAddress
            Me.ImageAddress = Null

Because Me is still holding a referenct to your image, which can block your kill
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
Chi Is CurrentAuthor Commented:
It seems switching:

Kill Me.ImageAddress
Me.ImageAddress = Null

to

Me.ImageAddress = Null
Kill Me.ImageAddress

would remove the filename of the file I want to delete.
0
 
DhaestCommented:
Add a string then, before deleting it
dim myImage as string
myImage = me.imageAddress
Me.ImageAddress = Null
Kill myImage
0
 
Chi Is CurrentAuthor Commented:
Dhaest ~

Good idea, thank you.  I wrote the address to a variable and attempted to delete the variable.

Then path name IS correct; however, I still receive: Path/File access error (Error 75)
0
 
UniqueDataCommented:
I know an answer was already accepted, but I thought I would add something I came across.  I was getting the same error and I noticed that the file attributes had ReacOnly turned on.  I was given the suggestion to change the attributes before the Kill statement and it worked perfectly.  My post can be found here:

http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_23879799.html#a22896634
0
 
Chi Is CurrentAuthor Commented:
UniqueData ~  Thank you for your comment here.  THAT WAS EXACTLY WHAT I DISCOVERED TOO!  Dheast's suggestion in the first comment kind of pointed me in that direction, when it was obvious there was no way the file could be in use.  At the time, I didn't post it because of my deadline.

Somehow, whoever was generating new files had begun setting the ReadOnly property ON, unbeknownst to anyone else!  So I did include a statement in my function to change the property before the kill statement and it was fine.

Thank you for your contribution here.  I trust this will serve others!

Best Regards, Jacob
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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