txgeekgirl
Registered User.
- Local time
- Today, 02:37
- Joined
- Jul 31, 2008
- Messages
- 187
Below is the code I am using to make a directory folder. I do need to set the Share Name and Security Permissions in VBA. I found that little three lines at the bottom but it is bombing on SetAccess. I am guessing it's a VB command and not VBA crossover - does anyone know a command for this? 

Code:
[B]Sub Create_E_Drive()
Dim FName, LName, Target, FolderName As String
Dim sUserName As String
Dim sFolderName As String[/B]
[B]
Target = "\\File_Center\Folders\"
FName = DLookup("NewStaff_F_Name", "NewStaffRequests", "ID = " & myRec)
LName = DLookup("NewStaff_L_Name", "NewStaffRequests", "ID = " & myRec)
FolderName = FName & LName
'Make Directory
If Dir(Target & FolderName, vbDirectory) = "" Then
MkDir Target & FolderName
Else
MsgBox ("E:\ Exists - will check for shares and permissions.")
End If
sUserName = FName & " " & LName
sFolderName = FolderName & "$"
SetAccess sUserName, sFolderName, GENERIC_READ Or GENERIC_EXECUTE Or Delete Or GENERIC_WRITE Or GENERIC_ALL[/B]
[B]
End Sub[/B]