Create directory

  • Thread starter Thread starter Daddio
  • Start date Start date
D

Daddio

How do I coax Access to programmatically create a new
directory in the 'right' place with the 'right' name?
First let's just get this out' the way: I know just enough
about this stuff to be dangerous. 'Nuf said.
I have records of experiments in a nice little dB. I also
have associated files (spreadsheets, photos, etc.) stored
in folders that are at least named according to the record
numbers. I have a button on the form that opens Windows
Explorer to the right folder, but if such a folder doesn't
exist...
I am not storing thesse files directly into the dB to
avoid dB hugeness. (I remeber what happened in The Matrix.)
Help me!
 
MkDir "C:\NewDirectory\"

If the directory exists, then you will get an error.

Also,
If DIR("C:\NewDirectory",vbDirectory) = "" then
MkDir "C:\NewDirectory\"
End If


Chris
 
One way is with VBA's MkDir statement, but this only lets you create one
level at a time. For instance if you have

D:\Folder
and want to create
D:\Folder\Subfolder\Deeper
you have to create each level separately, e.g.
MkDir "D:\Folder\Subfolder"
MkDir "D:\Folder\Subfolder\Deeper"
 
Back
Top