Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2012
    Posts
    13

    Run-time error '3044'

    Greetings,


    I have a BE database, that when opened, opens a form for saving the results of a query to a text file on the desktop.
    It works fine, if the full path is entered.
    The problem is, I want this saved on any users' desktop.
    I did some digging and found the %userprofile% variable, which when used, gives me the error.
    I understand this should work in both Windows XP and Windows 7, which are the environments the full DB will operate in.
    So far the "EXPORT" button on the form has the following for the code:

    Code:
    Private Sub BTN_Export_Click()
     DoCmd.TransferText acExportDelim, , "QRY_ExportPublicComment", "C:\Users\Mark N. McAllister\Desktop\PubComExp.txt"
    End Sub
    When I tried this:

    Code:
    Private Sub BTN_Export_Click()
     Dim strPath As String
     strPath ="%userprofile%\desktop\PubComExp.txt"
     DoCmd.TransferText acExportDelim, , "QRY_ExportPublicComment", strPath
    End Sub
    the error occurs.

    What's wrong?

    TIA
    MNM

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    sUser = Environ("Username")

  3. #3
    Join Date
    Aug 2012
    Posts
    13
    Quote Originally Posted by ranman256 View Post
    sUser = Environ("Username")
    Thanks, but I'm not sure where or how to use this...
    MNM

  4. #4
    Join Date
    Aug 2012
    Posts
    13
    Greetings,
    While scrounging around the web, I came across something quite interesting.
    On http://windowssecrets.com/ the user HansV posted some modules and a form in the thread here;
    http://windowssecrets.com/forums/sho...-Access-(2003)
    This allows the user to open the SaveAs dialogue box.
    I've decided to try this route, as it seems the path needs to be hard-coded into the transfer method.
    Attached Files Attached Files

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

Similar Threads

  1. Replies: 2
    Last Post: 09-15-2014, 10:31 AM
  2. Access 2010 Error 3044 when using shortcut
    By Bill Garner in forum Access
    Replies: 1
    Last Post: 12-10-2012, 02:10 PM
  3. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  4. Run-time error '3044'
    By niacin in forum Programming
    Replies: 3
    Last Post: 03-31-2012, 09:26 AM
  5. Run-Time Error 3044 - Invalid Path?
    By KrenzyRyan in forum Import/Export Data
    Replies: 8
    Last Post: 01-19-2011, 10:03 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