Connecting Tech Pros Worldwide Forums | Help | Site Map

Creation of Folders on Server

tdw's Avatar
tdw tdw is offline
Familiar Sight
 
Join Date: Mar 2007
Location: Woodbridge, Virginia
Posts: 206
#1: Nov 18 '08
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:
Expand|Select|Wrap|Line Numbers
  1. '   Create Folder on O: drive
  2.     yr = Left([FILE_NO], 4)
  3.     stOrdnum = Right([FILE_NO], 4)
  4.     stFileNumber = [FILE_NO]
  5.     stPathName = "O:\Orders_" & yr & "\" & [FILE_NO]
  6.     stFileName = [FILE_NO] & ".rtf"
  7.     stPFName = stPathName & "\" & stFileName
  8.  
  9.     If stOrdnum = "0001" Then
  10.         MkDir ("O:\Orders_" & yr)
  11.     End If
  12.  
  13.     If Dir$(stPathName, vbDirectory) <> "" Then  ' Does Path Already Exist?
  14. '       Yes No Box
  15.         Msg = "The directory " & stPathName & " Already exits! Do you want to continue?"    ' Define message.
  16.         Style = vbYesNo   ' Define buttons.
  17.         Title = "Directory Already Exists"    ' Define title.
  18.         Response = MsgBox(Msg, Style, Title)
  19.             If Response = vbNo Then    ' User chose No
  20.                 GoTo Exit_Create_Order_File_Structure_Click
  21.             End If
  22.     Else
  23.         MkDir Path:=(stPathName)   '  Create Directory Structure
  24.     End If
  25.  

ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,216
#2: Nov 18 '08

re: Creation of Folders on Server


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.
tdw's Avatar
tdw tdw is offline
Familiar Sight
 
Join Date: Mar 2007
Location: Woodbridge, Virginia
Posts: 206
#3: Nov 18 '08

re: Creation of Folders on Server


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!
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,216
#4: Nov 18 '08

re: Creation of Folders on Server


You can Create, Manipulate, and Retrieve Properties from Folders, but to assign specific Access Rights to them programmatically, 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.
tdw's Avatar
tdw tdw is offline
Familiar Sight
 
Join Date: Mar 2007
Location: Woodbridge, Virginia
Posts: 206
#5: Nov 18 '08

re: Creation of Folders on Server


Quote:

Originally Posted by ADezii

You can Create, Manipulate, and Retrieve Properties from Folders, but to assign specific Access Rights to them programmatically, 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.
Reply