Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create a folder at run-time? 1

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
I have created a custom common dialog box but I don't know how to create a file folder at run-time.

Is this possible? If so, can anybody please show me how.

thanks,

 
MkDir path

The required path argument is a string expression that identifies the directory or folder to be created. The path may include the drive. If no drive is specified, MkDir creates the new directory or folder on the current drive.

OR
Dim objFSO as New Scripting/FileSystemObject
objFSO.CreateFolder(foldername)

Description

Creates a folder.

Syntax

object.CreateFolder(foldername)

The CreateFolder method has these parts:

Part Description
object Required. Always the name of a FileSystemObject.
foldername Required. String expression that identifies the folder to create.

 
Thanks John,

Maybe you can help me with another problem related to this one. Now that I have created a folder, I need to transferText my database tables into this folder, but when I tried to do this, I got this error message:

"Runtime error "3051"
The MIcrosoft Jet database engine cannot open the file 'cases'. It is already opened exclusively by another user, or you need permission to view its data.@@@2@5003051@2.

this is my code:

If Dir(txtFileName.Text) <> &quot;&quot; Then
Kill (txtFileName.Text)
End If
MkDir (txtFileName.Text)
For Each tablename In db.TableDefs
If Left(tablename.Name, 4) = &quot;CASE&quot; Then
DoCmd.TransferText acExportDelim, &quot;Import Specification&quot;, tablename.Name, txtFileName.Text, 0
End If
Next


 
I see you made a directory with the name in
txtFileName.Text
and then use
DoCmd.TransferText acExportDelim, &quot;Import Specification&quot;, tablename.Name, txtFileName.Text, 0

Does the Jet Engine expect a DIRECTORY name ONLY or a full Path/FileName
e.g.
txtFileName.Text & &quot;\&quot; & tablename.Name & &quot;.txt&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top