Results 1 to 5 of 5

Thread: [RESOLVED] RmDir - Run-time error '75'

  1. #1

    Thread Starter
    Addicted Member seditives's Avatar
    Join Date
    Jan 2011
    Location
    South of England
    Posts
    151

    Resolved [RESOLVED] RmDir - Run-time error '75'

    Hi, Now I know how much you coding gurus like people to put detail into the issue, so I have put in the lot hope this is enough information for you to come up with a solution =D

    I am using a button to execute the following command:

    Code:
    Private Sub cmdDelete_Click()
    
    RmDir (App.Path & "\CPI\" & txt1.Text)
    
    End Sub
    I thought that this was meant to delete the folder and its contents but instead I get this error:

    Run-time error '75'

    Path/File access error
    which is most annoying =[....lol

    ohh and before any one even thinks the word hidden or admin rights I know for certain that the directories that can be deleted have no hidden files in as they are created using the MkDir command (jus throught I would mention that they are made that way encase that is the problem) and as for the folder rights the Name command seems to work fine .....

    ohh and I am not opening the folder with any other command or via the notorious Explorer

    Please get back as soon as possible, and thanks for reading through =D
    A subtle thought that is in error may yet give rise to fruitful inquiry that can establish truths of great value. - Isaac Asimov

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: RmDir - Run-time error '75'

    In order ,for RmDir to work directory must not contain any files - if it does you have to delet them all first.
    Here is the quote from MSDN:
    Code:
    RmDir Statement
          
    
    Removes an existing directory or folder.
    
    Syntax
    
    RmDir path
    
    The required pathargument is astring expression that identifies the directory or folder to be removed. 
    The path may include the drive. If no drive is specified, RmDir removes the directory or folder on the current drive.
    
    Remarks
    
    An error occurs if you try to use RmDir on a directory or folder containing files. 
    Use the Kill statement to delete all files before attempting to remove a directory or folder

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: RmDir - Run-time error '75'

    You may instead use FileSystemObject:
    Code:
    Option Explicit
    
    Private Sub Command1_Click()
    Dim fso As Object
    
    On Error GoTo ErrHandler
    
        Set fso = CreateObject("Scripting.FileSystemObject")
        fso.DeleteFolder App.Path & "\CPI\" & txt1.Text, True
        Set fso = Nothing
        
        Exit Sub
        
    ErrHandler:
    
        MsgBox Err.Description
        Err.Clear
        Exit Sub
    
    End Sub

  4. #4

    Thread Starter
    Addicted Member seditives's Avatar
    Join Date
    Jan 2011
    Location
    South of England
    Posts
    151

    Re: RmDir - Run-time error '75'

    TY !! that was a quick response and not to good to be true either. nice one RhinoBull =D are make sure to rate
    A subtle thought that is in error may yet give rise to fruitful inquiry that can establish truths of great value. - Isaac Asimov

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width