title: MS Access create multi level subfolders
body: <p>How can I programmatically create multiple levels of subfolders in VBA for MS Access? I know that MKDir only allows me to create one level, but I want to create 2 levels. The first level folder is based on the year the shipment took place, then the sub-level folder to that is the shipment number. The idea is to check and see if a folder(s) exists, and if not to create and open them. </p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>Private Sub Command173_Click()
   Const strParent = "S:\shipments\"
   Dim strYearEntered As String
   Dim strEntryNumber As String
   Dim strFolder As String
   Dim fso As Object
   strYearEntered = Me.YearEntered
   strEntryNumber = Me.EntryNum
   strFolder = strParent &amp; strYearEntered &amp; "\" &amp; strEntryNumber
   Set fso = CreateObject("Scripting.FileSystemObject")
   If fso.FOLDEREXISTS(strFolder) = False Then
       fso.CreateFolder strFolder
   End If
   Shell "explorer.exe " &amp; strFolder, vbNormalFocus
  </code></pre>
  
  <p>End Sub</p>
  
  <p>Using this code gives me an error at the "fso.CreateFolder strFolder" line. This problem only occurred when I placed the "\" in the strFolder line, without the "\" it will only create one folder by cramming together the YearEntered and EntryNum values. Can anyone assist in this matter?</p>
  
  <p>Thanks.</p>