microsoft access help database programing developer
Back to Access Experts About Access Experts Access Experts Websites Access Experts Team Access Experts Services Access Experts Case Studies Access Expert Tips Contact Access Experts OUR BLOG
 
 
How to create a new directory using Access VBA
by Juan Soto
10/09/2009

Create directories under the same path of the database

If you need to create a directory under the same path of your database, use the following code:
    Dim strPath As String
   
    strPath = CurrentProject.Path & "\MyFolder"    'Replace MyFolder with the name of the folder you wish to create

    'Is the directory created? This step is necessary in order to avoid an error
    If Dir(strPath, vbDirectory) = "" Then
        MkDir strPath  'The MkDir command is used to create the folder
    End If
   
    'Is the workorder dir created?
    strPath = strPath & "\" & Me.WorkorderID
    If Dir(strPath) = "" Then
        MkDir strPath
    End If
    
We hope this codehelps you out, and if you get stuck give us a call, we help clients throughout the USA with Access problems.


If you like this tip you will be delighted with our service! Call or write us today for a free quote regarding your computer needs.

Publish this article in your own corporate newsletter or publication! Contact us to obtain a free license.


Home | About Us Why PCExperts | Team | Services | Newsletter | Contact Us
Copyright © 2004