Results 1 to 7 of 7
  1. #1
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68

    Set "My Documents" Path


    I create and share db's with others in my group. Most of these db's have VBA code for importing and exporting files. My VBA code contains the Path to the "My Documents" folder (C:\Documents and Settings\{MYID}\My Documents\Access). Whenever I share the db's, I go in and globally change {MYID} to the target users ID. I've changed the code in my most recent db to "%USERPROFILE%\My Documents\Access", and it's working in most situations. However, it doesn't seem to work with the DoCmd.TransferText statement. Any suggestions as to how I can get around this?

  2. #2
    Join Date
    May 2010
    Posts
    339
    take a look at this example DB. Open it up in design view and look at the code behind the buttons. It defaults to the My Documents folder

  3. #3
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68
    Thanks, but I don't believe you've answered my question. I want to use a folder below "My Documents" (My Documents\Access, etc). Also, although your example points to the My Documents folder, I don't see anything in your code that causes that:
    Private Sub Xfer_text_btn_Click()
    DoCmd.TransferText acExportDelim, "Inventory_Specs", "M_Inventory", "Inventory.csv"
    End Sub
    Can you help me to understand?

  4. #4
    Join Date
    May 2010
    Posts
    339
    I am sorry I did miss that "My Documents\Access" how about using a dialog box ? this can be edited.

    http://www.mvps.org/access/api/api0001.htm

  5. #5
    Join Date
    May 2010
    Posts
    339
    Try this now I put in the dialog box for you.

  6. #6
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68
    This should work fine. Thanks for your help. Muchly appreciated!

  7. #7
    Join Date
    May 2010
    Posts
    339
    That can be used for importing this is what you might use as an export.

    DoCmd.TransferText acExportDelim, "Standard Output", _
    "External Report", "C:\Documents and Settings\Administrator\My Documents\access\my.csv


    Richard

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

Similar Threads

  1. Replies: 3
    Last Post: 04-10-2010, 10:22 AM
  2. Replies: 21
    Last Post: 06-03-2009, 05:54 PM
  3. aSTR = Dir("C:\*.*") >> "Type Mismatch"
    By JGrant in forum Programming
    Replies: 1
    Last Post: 03-28-2009, 05:17 AM
  4. Replies: 2
    Last Post: 08-31-2006, 12:19 PM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 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