Make Directory

A

Avais

This will work,

Bacause of the space in the folder names Access creates
the first folder "subfolder". Work around would be to
concatenate all words in the folder name, see below.
Use a variable instead of the "ProjectNumber100"

Avais

Function CreateFolder()

Dim cstrLocalPath As String

cstrLocalPath = "C:\subfolder" & "1\subfolder" & "2
\subfolder" & "3\" & "ProjectNumber100" & "\"
Shell ("cmd /c md " & cstrLocalPath)

End Function



-----Original Message-----
In my database, every new record needs to create a new
folder on the network. The folder name will be equal to
the value of the records ProjectNumber (text) field. So
far, the code I have in the AfterInsert property of my
entry form (shown below) should create a folder
named "NewFolder". But nothing happens -- no errors or
anything. Ultimately, I need to know how to change the
code from "NewFolder" to a variable equal to the field
ProjectNumber. Possible?
Private Sub Form_AfterInsert()
'Create a new subfolder called NewFolder
Shell ("c:\winnt\system32\cmd.exe /c md
\\servername\subfolder 1\subfolder 2\subfolder 3
\NewFolder")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top