Results 1 to 9 of 9
  1. #1
    dancaw is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2021
    Posts
    13

    Folder Buttons

    Hi,

    I Have a folder location field which stores the folder location path of a project.

    at moment I'm having to Paste the file path in manually.

    I would Like a Select File Button and Open Store File Path Button

    FieldName: "FolderLocation"
    TxtBox: "fld_folderlocation"

    Kind Regards



    Dan

  2. #2
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    First link I found from a Google search for 'vba directory dialog box': https://wellsr.com/vba/2016/excel/vb...gFolderPicker/

    Let us know if this works for you.

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    If you want the file path, you don't want the folder picker, you want the file picker. I didn't see that on that link.
    Google ms Access File Picker or perhaps start with

    https://docs.microsoft.com/en-us/off...ice.filedialog
    Last edited by Micron; 01-04-2021 at 07:48 AM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    dancaw is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2021
    Posts
    13
    Quote Originally Posted by Micron View Post
    If you want the file path, you don't want the folder picker, you want the file picker. I didn't see that on that link.
    Google ms Access File Picker or perhaps start with

    https://docs.microsoft.com/en-us/off...ice.filedialog
    Hi thank you for Link:

    I've managed to get it Selecting file path link, though it seems to save the Previous top level

    Used the following code:

    HTML Code:
    Private Sub cmdHyperlink_Click()
    Dim fd As FileDialog
    Set fd = Application.FileDialog(msoFileDialogFolderPicker)
    With fd.AllowMultiSelect = False
    if .Show Then    Me.FolderLocation.Value = .InitialFileName   
    End If    
    End With    
    End Sub
    No Sure if im Missing something

    If i select Z:\Test\Test2

    it stores

    Z:\Test\

    SO i have to select

    Z:\Test\Test2\Test3

    then saves as

    Z:\Test\Test2\

    still not worked out to create button to open "Z:\Test\Test2"

    Regards

    Dan

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Hmm, the link I gave you had code for the file picker? But you used...
    (msoFileDialogFolderPicker)

    EDIT - that is not how your code is really laid out? If so, you should be getting errors.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    Try
    Code:
        Dim fd As FileDialog
        Set fd = Application.FileDialog(msoFileDialogFolderPicker)
        With fd
            .AllowMultiSelect = False
            If .Show Then
                Me.fld_folderlocation = .SelectedItems(1)
            End If
        End With

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    You need the folder picker if you are trying to save a folder path, and the file picker if you want to store a filepath.?

    You might want to add a \ to the folder path if you expect to add a filename to it all the time?

    The Folder Link worked fine for me?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    dancaw is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2021
    Posts
    13
    Thanks Kd2017

    Works Like I Charm

    also Thank you Micron for your assistance

  9. #9
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Quote Originally Posted by Welshgasman View Post
    You need the folder picker if you are trying to save a folder path, and the file picker if you want to store a filepath.?
    I'm with you (and I already pointed this out). I guess what threw me is
    "at moment I'm having to Paste the file path in manually."

    Seems it was the folder path after all.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 6
    Last Post: 06-06-2019, 02:29 PM
  2. Replies: 3
    Last Post: 06-24-2016, 06:51 AM
  3. Replies: 10
    Last Post: 09-09-2015, 03:25 AM
  4. Replies: 1
    Last Post: 05-15-2015, 10:58 AM
  5. Replies: 4
    Last Post: 06-27-2013, 12:29 PM

Tags for this Thread

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