Results 1 to 7 of 7
  1. #1
    johnjo is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Dec 2023
    Posts
    2

    [Help] How to create a new folder following client's name

    I want to make a button which automatically creates a new folder that its name is following the name of the client.
    I put more details in the GG Drive link bcz the attached file size is 2MB > 500KB limit of the forum


    Please take a look, thank you guys!

    https://drive.google.com/file/d/1lZE...ew?usp=sharing

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Use MkDir command https://learn.microsoft.com/en-us/of...kdir-statement

    Can attach a 2MB zip folder.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69
    Something Like this;

    Code:
    Public Sub MakeFolder(strPath As String)
    Dim strCName aAs String
    
    
    	strCName = Me.txtClientName.Value 'Or where ever you choose to get the name from.
    	MkDir strPath & "\" & strCName
    
    
    End Sub
    Adapt as needed to suit your DB.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Possibly first check that folder doesn't already exist.

    If Dir(strPath & "\" & strCName) = "" Then
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    johnjo is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Dec 2023
    Posts
    2
    I'll try it, thank you both, June7 and Salty Mariner

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    As you'll no doubt learn, there are usually numerous ways to accomplish the same things in access.

    June and Salty have the MkDir() and Dir() functions covered so I'll add the FileSystemObject Method.

    I tend to use FSO when dealing with folders and files. There are a lot of helpful methods and properties. (FolderExists, FileExists, BuildPath, etc.)
    https://learn.microsoft.com/en-us/of...mobject-object

    The attached example will add a "Clients" folder in the application directory. You can enter a name and it will add a client folder named after the client in that Clients folder.
    I added a list box to show all the client folders in the master client folder.
    There is also a list box to show all the files in a selected clients folder.
    In the demo I added a sub to create a text file within the clients folder. This is just to show the flexibility of FSO and demonstrate the file listbox.

    note that I used late binding for the FSO object.
    Attached Files Attached Files
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  7. #7
    Salty Mariner is offline Intermediate
    Windows 11 Access 2021
    Join Date
    Dec 2023
    Location
    Corpus Christi, TX
    Posts
    69
    Moke, thank you for posting that example. That was outstanding!

    I am saving your example as I can already see a use for some of the methods that you posted

    Excellent work, Thank you.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Create Folder Bases on Two Fields
    By dancaw in forum Forms
    Replies: 33
    Last Post: 01-11-2021, 06:01 AM
  2. Replies: 1
    Last Post: 12-08-2020, 11:59 AM
  3. Create folder shortcut
    By Robyn_P in forum Programming
    Replies: 3
    Last Post: 03-27-2020, 09:15 AM
  4. Create A Folder With Textbox Value
    By Eranka in forum Access
    Replies: 10
    Last Post: 06-25-2018, 09:02 AM
  5. Create a folder into a network location
    By charly.csh in forum Access
    Replies: 7
    Last Post: 12-04-2015, 10:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums