Results 1 to 5 of 5
  1. #1
    Oblio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2013
    Posts
    50

    How to select a file pathway and pass it in a VBA Module

    I am using Access 2016 64 bit with Windows 10.
    Database is attached.

    I can import a list of files from a directory which is hard wired in.



    I would like to be able to allow the user to navigate to the folder they wish to import but I am not sure how to do this and am seeking help to modify this code I found on the internet.

    If anyone can help me out with this I would be very grateful !!!

    William
    Attached Files Attached Files

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Perhaps this link will be useful: http://access.mvps.org/access/api/api0054.htm

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I use Application.FileDialog to be able to select the folder, with the dialogType set to "msoFileDialogFolderPicker"
    The path defaults to your LAN path you had in the code.

    The code requires a reference set to Microsoft Office xx.0 Object Library ' 14.0 = Access 2010
    Attached Files Attached Files

  4. #4
    Oblio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2013
    Posts
    50
    Yes, it REALLY helped me thank you so much !!!!!!!!!!!!


    A question based on the Mod version. If I wanted to provide a textbox which would allow the user to input whatever they liked as the Starting pathway to look from "(sFolderSelected = "M:")"
    would I just use: sFolderSelected = "MyUnboundFormTextbox" rather than hardwiring the start path in?"

    And thank you again for your help...William


  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Yes, you could modify the code to do that. But what is entered in the text box must be a valid path.... and it could be a lot of typing..

    I usually set the default path to the Currentproject.Path or to "C:" and let them navigate from there.

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

Similar Threads

  1. Pass parameter to a VBA Module
    By testing2Three in forum Modules
    Replies: 4
    Last Post: 11-13-2014, 02:33 PM
  2. Replies: 6
    Last Post: 10-17-2014, 09:38 AM
  3. Replies: 3
    Last Post: 06-10-2014, 05:09 PM
  4. Need Module Coding Help - File Browser
    By kagoodwin13 in forum Modules
    Replies: 1
    Last Post: 05-02-2013, 11:08 AM
  5. How to pass what was clicked to module?
    By nichojo in forum Modules
    Replies: 11
    Last Post: 07-22-2010, 08:27 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