Results 1 to 6 of 6
  1. #1
    kspabo is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2014
    Posts
    22

    Universal path for exporting table


    I've created a macro that will export one of my tables to a .csv. Everything is all fine and dandy, except that I need to find a way to have this command work on any computer. As of now, the command exports to C:\Users\Kody\Documents, and can only do so because this path exists on my computer. But if I were to send this Access file to someone else to use, they would get an error stating that the specified path is not valid. Is it possible to create a general export directory which would work with any computer this is ran on?

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Paths will vary according to the operating system employed. ie. Win7 and Win XP have different path settings. You may have to provide an option (an inputbox) in your VBA asking the user where they want the file exported and then use that as the file path.

  3. #3
    kspabo is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2014
    Posts
    22
    EDIT:

    I've actually figured out how to use a basic window prompt, but is there any way to get a Windows file explorer window to show so that you can select your folder, rather than manually inputting the destination?

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    There is a "Browse for folder" example at http://access.mvps.org/access/api/api0002.htm

    I use different code, but I can't remember where I found it.

    Google: "Browse for folder VBA"


    Edit
    Also see http://www.access-programmers.co.uk/...d.php?p=440522

    This is pretty slick: http://www.your-save-time-and-improv...ct-folder.html

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Could maybe export to the same folder the db resides in by using the CurrentProject.Path method.
    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.

  6. #6
    fredz is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    19
    You can also utilize the Environ() function to access the Windows Environment Variables.
    Like UserProfile, Temp, WinDir, etc.
    Fred

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

Similar Threads

  1. Modified Universal Search
    By orange in forum Code Repository
    Replies: 4
    Last Post: 02-08-2017, 02:14 PM
  2. Universal Search
    By drunkenneo in forum Programming
    Replies: 1
    Last Post: 05-28-2014, 06:08 AM
  3. Replies: 6
    Last Post: 05-27-2014, 05:41 AM
  4. Display Linked table Path
    By gg80 in forum Access
    Replies: 3
    Last Post: 10-14-2011, 10:02 PM
  5. Universal Search
    By Douglasrac in forum Access
    Replies: 3
    Last Post: 05-20-2011, 06:25 PM

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