Results 1 to 2 of 2
  1. #1
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Create folders in a specific directory

    Hello all,



    I am doing some serious mental gymnastics and have read so many posts regarding mkdir and strpath and am completely confused at this point. I need to create several folders within a directory (on a network drive no less), which I did successfully initially using this code:
    Code:
    On Error GoTo Err_Command1043_Click
    Me.JobID = "E" & Format(Now, "yy") & "-" & Me.JobNum
    Dim addr As String
    addr = "E:"
        DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Exit_CommandSaveRecord_Click:
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME]
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Proposals"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Estimates"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Sheetmetal _Take_Off"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Drawings"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Specifications"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Addendums"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\AddendumDrawings"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\RFIs"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Miscelleneous"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Vendors"
    MkDir addr & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Subcontractors"
    
        If Me.Dirty Then Me.Dirty = False
       
        Exit Sub
    Err_Command1043_Click:
        If Me.Dirty Then Me.Dirty = False
        'MsgBox Err.Description
        'Resume Exit_CommandSaveRecord_Click
        Exit Sub
    End Sub
    But now I need to create these files within the current year's directory for each year. Currently trying this (reader's digest version)
    Code:
    targetpath = Me.saveto (***this is just a string expression from my form***)
    MkDir targetpath & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME]
    MkDir targetpath & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Proposals"
    MkDir targetpath & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Estimates"
    I end up with "2015E15- Jane Street - Phase 2" Where it should be "E:\2015\E15-Jane Street - Phase 2"

    I can see why it doesn't work, but I cannot see the solution. Can someone straighten me out please?

    Thank you in advance!

  2. #2
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Oh my goodness! I just figured it out. Nevermind. Thanks anyway.
    Code:
    MkDir targetpath & "\" & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME]
    MkDir targetpath & "\" & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Proposals"
    MkDir targetpath & "\" & [Forms]![currentjobs]![JobID] & " " & [Forms]![currentjobs]![JOB NAME] & "\Estimates"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-10-2014, 10:48 AM
  2. Replies: 2
    Last Post: 03-16-2014, 02:12 PM
  3. Replies: 6
    Last Post: 10-26-2012, 12:53 PM
  4. Create Windows Folder Regime (Many Sub Folders)
    By MSDeveloper in forum Code Repository
    Replies: 1
    Last Post: 10-14-2012, 01:43 PM
  5. Replies: 6
    Last Post: 06-15-2011, 04:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums