Shell(MD ...)

jaydwest

JayW
Local time
Today, 14:12
Joined
Apr 22, 2003
Messages
340
I would like to create a folder under MS Access control. I have tried the following code:

strMakeDir = "md " & strBackupFolder
var = Shell(strMakeDir, 0)

but I keep getting the error message "File Not Found". I get the same message when I type in "md c:\testfolder" However, I can type in an excutable file and it works fine.

The problem seems to be that the Shell command doesn' like md.

Does anyone know the answer?



:confused: :eek:
 
Hey Jay,

Would using this method help?

Dim isFolder As String
isFolder = Dir("C:\Reports\*")
If isFolder = "" Then
MkDir "C:\Reports"
End If

-Sean
 
Thanks for the prompt reply.

You have made my day!

:)
 
jaydwest said:
The problem seems to be that the Shell command doesn' like md. Does anyone know the answer?
I think SHELL only really works with executables. Try:
strMakeDir = "command.com /c md " & strBackupFolder
shell strMakeDir
 
Sean,

Thanks again for the answer. It worked great.

I did want to mention that the Dir(path) > vbnullstring does not work properly when there are no files in the folder. It returns false. I seemed to remember that MS changed this function a revision or two ago. I got the code from another database. I believe the syntax should be:

Not (Dir$(pasPath, vbDirectory) = vbNullString)

Thanks again
 
Thanks for clarifying Jay!

I took that from some code I wrote over a year ago and haven't used it since.

Cheers!
-Sean
 

Users who are viewing this thread

Back
Top Bottom