Create Folder (1 Viewer)

Philmore

Registered User.
Local time
Today, 14:11
Joined
Dec 20, 2001
Messages
21
I need to create directories from within access and use the records in the lastname field for the directory names.
 

raindrop3

Registered User.
Local time
Today, 14:11
Joined
Sep 6, 2001
Messages
98
Hello,

Check out the MKDIR statement.

Create a recordset with al the last names and do something like this:

recordset.movefirst
while not recordset.eof = true
mkdir "c:\" & recordset("lastname")
recordset.movenext
loop

greetings,

Albert
 

Philmore

Registered User.
Local time
Today, 14:11
Joined
Dec 20, 2001
Messages
21
I should have been more detailed in my description. If I use that code it would, i believe, create directories everytime i run the code. what I want is code that will create one folder each time I run it based on the record i'm in on the form. what I was thinking was something more along the lines

Private Sub create_Click()
Dim strDirectory As String
strDirectory = "C:\" & Me.FIRST_NAME & " " & Me.LAST_NAME
If Len(Dir$(strDirectory & "\.", vbDirectory)) > 0 Then
MsgBox "This folder already exists, please choose another patient record"
Else
MkDir (strDirectory):
MsgBox " A folder has been created at location '" & strDirectory & "'"
End If
End Sub

I wondering if this would work. What do you think.
 

Users who are viewing this thread

Top Bottom