Creation of Folders on Server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tdw
    New Member
    • Mar 2007
    • 206

    Creation of Folders on Server

    Hi all,

    This is an Access question, but it may spill over into requiring non-Access solutions. Please let me know if I should look for this answer elsewhere (and if you have suggestions on where to find it).

    My Orders Database creates a folder on our server for each new order we receive (i.e. each new record entered).
    It does this as a part of an OnClick Event from a command button.

    This folder structure on the server is very important. Each folder contains all of the files used for that particular survey order. It contains autocad drawings, pdf copies of invoices, photos, etc.

    There are several people who access these folders. For example, The field crew will save their field data and pictures into the folder. The draftsman will work with autocad files in that folder. Etc, etc etc.

    The problem we run into sometimes is that a folder will accidentally get deleted, renamed, or moved into a neighboring folder, due to carelessness with the mouse or a keyboard stroke. This is a bad bad thing to have happen.

    I am not very familiar with what kind of options I have as far as protecting a folder from deletion, renaming, or being moved, while still allowing unfettered access to create, delete, and modify the files inside that folder.

    Here's the part relevant to Access: if Windows even has the capability of the type of protections for folders that I need... is there a way through VBA to assign those protections to a folder that is created with the VBA code?

    Here is how the relevant portion of the OnClick event looks:
    Code:
    '   Create Folder on O: drive
        yr = Left([FILE_NO], 4)
        stOrdnum = Right([FILE_NO], 4)
        stFileNumber = [FILE_NO]
        stPathName = "O:\Orders_" & yr & "\" & [FILE_NO]
        stFileName = [FILE_NO] & ".rtf"
        stPFName = stPathName & "\" & stFileName
    
        If stOrdnum = "0001" Then
            MkDir ("O:\Orders_" & yr)
        End If
        
        If Dir$(stPathName, vbDirectory) <> "" Then  ' Does Path Already Exist?
    '       Yes No Box
            Msg = "The directory " & stPathName & " Already exits! Do you want to continue?"    ' Define message.
            Style = vbYesNo   ' Define buttons.
            Title = "Directory Already Exists"    ' Define title.
            Response = MsgBox(Msg, Style, Title)
                If Response = vbNo Then    ' User chose No
                    GoTo Exit_Create_Order_File_Structure_Click
                End If
        Else
            MkDir Path:=(stPathName)   '  Create Directory Structure
        End If
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Hello tdw, in all honesty, I think that this is a question that should be directed to your Network Administrator. It really is not considered an Access issue as far as I am concerned.

    Comment

    • tdw
      New Member
      • Mar 2007
      • 206

      #3
      I understand where you are coming from.
      I was hoping that someone would already know how to code these kinds of protections into the VBA in Access.

      Since the first hurdle is to find out if such a thing exists in Windows, I'll keep looking for that answer. I'll return to this question if I found that part out, so that at that point it will really be an Access question.

      Thanks!

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        You can Create, Manipulate, and Retrieve Properties from Folders, but to assign specific Access Rights to them programmaticall y, my guess would be that you would have to use the Windows API. This would not be a task to be taken lightly. When I get some free time, I'll see what I can come up with.

        Comment

        • tdw
          New Member
          • Mar 2007
          • 206

          #5
          Originally posted by ADezii
          You can Create, Manipulate, and Retrieve Properties from Folders, but to assign specific Access Rights to them programmaticall y, my guess would be that you would have to use the Windows API. This would not be a task to be taken lightly. When I get some free time, I'll see what I can come up with.
          Thanks ADezii. Just as a clarification, I don't want to restrict access to the contents of the folders. I just want to prevent the folders themselves from being deleted, moved, or renamed. Some way of super-gluing the directory tree (while, of course, still allowing new folders to be created.)

          But, I digress... the above really isn't Access, unless it can be done with VBA as a part of the new folder creation process.

          Comment

          Working...