Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Export from a table (transfer text)

  1. #1
    Join Date
    Aug 2007
    Posts
    7

    Export from a table (transfer text)

    I've used DoCmd.transfer text with other projects to export a table in Access to a text file, and I am trying to do the same here, but with no success.

    Code:
    Public Function EXPORT_Inspections()
    
    
        DoCmd.TransferText acExportFixed, "Export1", "Inspection_EXPORT", "c:/exp.txt", True, ""
            
    
    End Function
    I keep getting:
    The Microsoft Access database engine could not find the object <name>. Make sure the object exists and that you spell its name and the path name correctly. (Error 3011)

    Anybody have an idea about that?

    Thanks,
    J

  2. #2
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275
    In your code

    DoCmd.TransferText acExportFixed, "Export1", "Inspection_EXPORT", "c:/exp.txt", True, ""

    Is Export1 your Specification Name?

    "c:/exp.txt" should be "c:\exp.txt"
    Allan

  3. #3
    Join Date
    Aug 2007
    Posts
    7
    Yes, I've got a fixed width table specification with the name Export1.

    Weird, I'm still getting the errors after those changes....

  4. #4
    Join Date
    May 2006
    Posts
    407
    I believe the statement is looking for the HTML table name, but you have identified that table name as a zero length string by putting the comma and the two double quotes at the end of your statement. Try this statement:
    Code:
    DoCmd.TransferText acExportFixed, "Export1", "Inspection_EXPORT", "c:\exp.txt", True

  5. #5
    Join Date
    Aug 2007
    Posts
    7

    Error 3011

    It's still not working, and I am trying to understand this error code and message without any success.

    Run-time error '3011':
    "The Microsoft Office Access database engine could not find the object 'test#txt'. Make sure the object exists and that you spell its name and the path name correctly.

    Why is it trying to find 'test#txt'? I don't need it to find test#txt, I need it to export a table to a fixed width file. Anyone have any ideas?

    (thanks for your help)

  6. #6
    Join Date
    May 2006
    Posts
    407
    Please post the latest statement you are using that is giving you the error. Thanks!

  7. #7
    Join Date
    Aug 2007
    Posts
    7
    Sorry about that- it basically hasn't changed except for the end.

    Public Function EXPORT_Inspections()


    DoCmd.TransferText acExportFixed, "RTM_Export", "Inspection_EXPORT", "test.txt", True


    End Function

    --------
    RTM_Export is the specification name...

  8. #8
    Join Date
    May 2006
    Posts
    407
    I would suggest putting the C:\ back into the name of the output file: "C:\Test.txt" rather than just "test.txt".

    I also notice you have changed the name, or changed what output specs you are using. At first it was Export1, but now the name is "RTM_Export" Did you just rename Export1 to RTM_Export, or did you create a new specification? Have you reviewed the specification closely?

  9. #9
    Join Date
    Aug 2007
    Posts
    7
    Sorry about that. "RTM_export" is the table specification. I was trying to be as general as possible. I also changed the file back to c:\. Still the same error. It's so confusing- because it seems like it is trying to reference the file in the location instead of just exporting it.

  10. #10
    Join Date
    May 2006
    Posts
    407
    Will, could you show us the export specifications (RTM_export). I would like to see a screen print for that if you know how, otherwise, just do a hand copy the best you can. Also, 4 to 5 sample records of the query or table you are trying to export, with the field names included. Suggest you select 4 or 5 records, copy them to the clipboard, then paste them into an Excel spreadsheet, then do a screen print of the Excel spreadsheet.

    Does the file C:\Text.txt alread exist?

  11. #11
    Join Date
    Aug 2007
    Posts
    7
    c:\test.txt does not exist.

    Attached are 3 screenshots. Table export specs, and the actual table (I couldnt get all the fields in the shot, but they are all there.)
    Attached Images Attached Images

  12. #12
    Join Date
    May 2006
    Posts
    407
    the field Deficiency is defined as a Long Integer, but the data in the table is TEXT. You need to go down each one of the fields in your table, and make the output specs match what is in the table.

  13. #13
    Join Date
    Aug 2007
    Posts
    7
    I moved them all to text, and am still having the same issue. Arg.

  14. #14
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275
    What is the result if you use DoCmd.TransferText acExportFixed, "", "Inspection_EXPORT", "c:/exp.txt", True, ""
    Allan

  15. #15
    Join Date
    Sep 2007
    Posts
    6
    Been reading this thread and it was interesting. Wog, did you already solve the problem? What codes did you use? I just want to look at them for reference. I'm trying to learn more by reading posts.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •