Using ADO Record to Create and Navigate Intranet Files and Folders - Creating folders
(Page 2 of 6 )
The following picture shows the intranet site, the default website which can be accessed by its URL, http://hodentek. You will notice that there is no folder by the name DevHome.

Add a form in design and add the code you will see below to the click event of the button. You will find the comments added at appropriate places. This code creates a DevHome folder in the intranet site. Sine it is a folder the adCreateCollection enum constant has been used. If the directory exists, it is overwritten. The over writing does not affect the files contained in the folder. This was later verified.
The options can be added as shown, and in fact the code completion utility helps you in doing so. The open method of the record takes several arguments which are shown in the following picture. After typing in record.open just put an empty space, wait for the drop down to show up and then start typing in the values or picking from ensuing drop-down for each argument.

record.Open (source[can be an url],
ActiveConnection,
Mode,
CreateOptions,
Options,
Username,
Password)
Option Compare Database
Private rec As ADODB.Record
Private rst As ADODB.Recordset
Private Sub Command0_Click()
Set rec = New ADODB.Record
'This adds the DevHome Directory to the Server
rec.Open "DevHome", "URL=http://hodentek/", , _
adCreateOverwrite + adCreateCollection
rec.Close
'This adds ASPFree folder to the DevHome Folder
rec.Open "DevHome/ASPFree", "URL=http://hodentek/", , _
adCreateOverwrite + adCreateCollection
rec.Close
'similarly two other folders are added to the DevHome folder
rec.Open "DevHome/DevShed", "URL=http://hodentek/", , _
adCreateOverwrite + adCreateCollection
rec.Close
rec.Open "DevHome/DevArticles", "URL=http://hodentek/", , _
adCreateOverwrite + adCreateCollection
rec.Close
End Sub
When this code is run you may verify in your default web site that the folder DevHome is created as shown.

While the first statement creates the DevHome folder, the statements that follow create the other sub-folders as shown. Notice that the ASPFree folder is now empty. Actually the others are also empty as well.

Since these folders are created in the web site, they actually reside in the root directory of the site. This is shown in the next picture.

Next: Creating files >>
More Database Articles
More By Jayaram Krishnaswamy