Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer 33 Lessons    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Create Folder with sub folders
Carl Bush 
    
4 years ago
Hi Richard

I have used the code below in a button to create a folder on the hard drive when I add a new customer is it possible to create subfolders within that folder at the same time

Private Sub Command96_Click()
Dim FSO As New FileSystemObject
Dim FolderName As String
FolderName = Myfolder & (Forms!customerf.FirstName) & " " & (Forms!customerf.LastName)
If Not FSO.FolderExists(FolderName) Then
FSO.CreateFolder (FolderName)
End If
Set FSO = Nothing
End Sub


Regards

Carl
Adam Schwanz  @Reply  
           
4 years ago
Sure, should work to just run the code again after with a modified form name in the same button.

Dim FSO As New FileSystemObject
Dim FolderName As String
FolderName = Myfolder & (Forms!customerf.FirstName) & " " & (Forms!customerf.LastName)
If Not FSO.FolderExists(FolderName) Then
FSO.CreateFolder (FolderName)
End If
Set FSO = Nothing

Dim FSO2 As New FileSystemObject
Dim FolderName2 As String
FolderName2 = Myfolder & (Forms!customerf.FirstName) & " " & (Forms!customerf.LastName) & "\NewFolder"
If Not FSO2.FolderExists(FolderName2) Then
FSO2.CreateFolder (FolderName2)
End If
Set FSO2 = Nothing
Carl Bush OP  @Reply  
    
4 years ago
Hi Adam thanks very much for your help that worked a treat I wanted a customer folder with 4 subfolders so just copied your code another 3 times  it's probably not as elegant a solution as you or the great man would use but it works and I'm over the moon

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 33 Lessons.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/15/2026 2:05:34 AM. PLT: 0s