Wednesday, December 5, 2007

Create Folder in MS Access

Let say you want to create a new folder if it does not exist when you run your application, here is the sample code:

Dim strFolder As String
strFolder = "C:\New Folder"

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

‘Check whether the folder exists
If Not fso.FolderExists(strFolder) Then
FileSystem.MkDir (strFolder)
End If

4 comments:

Timothy A. Valentine on June 12, 2008 at 10:51 PM said...

Thanks.
I've used Access for years but never had the occasion where I needed to create a folder with VBA. I was normally the person that would set everything up for the user, so I didn't have to worry about it. This worked perfectly. I tried various methods that did work and even modified a few of them and nothing. This was perfect.

Thanks.

Tim (Nashville, TN)

Anonymous said...

thanx!!!
I was looking this for days

AlanK said...

Could you possibly detail where to put this code, and how to call it from, say, a macro? Thanks.

xiaoyu on July 26, 2011 at 9:04 AM said...

Hi AlanK, it is a sample code to create folder in windows through visual basic M.S. Access

 

Get paid for your opinions! Click on the banner above to join Planet Pulse. Its totally free to sign up, and you can earn UNLIMITED. Find out more by visiting PLANET PULSE.
July Code Blog Copyright © 2010 Blogger Template Designed by Bie Blogger Template