Can Acces create a directory?

  • Thread starter Thread starter notDave
  • Start date Start date
N

notDave

Is there a way (DoCmd?) to check to see if a Windows
folder exists before trying to export a file to that dir?
Right now I'm using Access to run a .bat file, which
checks for the dir and creates if it doesn't exist, but
I'm wondering if there's a better way.

~notDave
 
Good morning

To create a directory, you can use the following code:

If Len(Dir("C:\Test", vbDirectory)) = 0 Then
' Directory doesn't exist. Create It
MkDir "C:\Test"
End If

Note that you cannot do

If Len(Dir("C:\Test\Subfolder", vbDirectory)) = 0 Then
' Directory doesn't exist. Create It
MkDir "C:\Test\Subfolder"
End If

if Test doesn't already exist.


Hope this helps

Maurice St-Cyr

Micro Systems Consultants, Inc.
 
Back
Top