[AccessD] Creating Subdirectories

Jurgen Welz jwelz at hotmail.com
Sun Oct 19 10:45:15 CDT 2008


I just tried making and then deleting a folder in the same sub procedure with a hard coded folder beneath our S:\GOM folder and there was no difficulty.  I checked explorer to verify that the folder did not preexist before running the code.  Should there have been an exisiting folder, I would  have had to first delete any files or sub folders below the GOM\toe\ root.

Public Sub MkRmDir()
    MkDir "s:\Gom\toe"
    If GetAttr("s:\Gom\toe") And vbDirectory Then
        MsgBox "Folder created"
        RmDir "s:\gom\toe"
        If Len(Dir("S:\Gom\toe")) Then
            MsgBox "Creation succeeded and Deletion failed"
        Else
            MsgBox "Creation and Deletion succeeded"
        End If
    Else
        MsgBox "folder creation failed"
    End If
End Sub

Running the code reports creation, then creation and deletion of the folder.
Folder deletion always fails when there are files in the folder.  Could that be an issue?

Ciao
Jürgen Welz
Edmonton, Alberta
jwelz at hotmail.com

> Date: Sun, 19 Oct 2008 08:01:44 -0700
> From: iggy at nanaimo.ark.com
> To: accessd at databaseadvisors.com
> Subject: [AccessD] Creating Subdirectories
>
> Hey All
> Thanks to all of you that responded. Yesterday was a "tired brain day".
> This morning I built a little routine using MKDIR to check and create
> the necessary subdirectories. I check first to see if the drive exists.
> Incorporated Jurgen's idea to check to see if the folder/directory was
> created (rights issue).
> One little glitch is if I try to delete the folder immediately after
> creating it, I get a message "Cannot delete folder. It is being used by
> another person or program". I have to exit Access and then I can delete it.
>
> Thanks again
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

_________________________________________________________________





More information about the AccessD mailing list