• Exporting a table using DoCmd (XP SP-2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Exporting a table using DoCmd (XP SP-2)

    Author
    Topic
    #394752

    Is there a way to export a table to a .txt format (doesn’t matter if tab or comma delimited) using the DoCmd.TransferDatabase command?
    I am attempting to export a table to another location in a .txt format using the DoCmd.TransferDatabase command. This is the current command…

    DoCmd.TransferDatabase acExport, “Microsoft Access”, “G:IRMPIRMP_Grain.mdb”, _
    acTable, “tblYearEnd”, “G:AppsAccesstblYearEnd.txt”

    When I try to run this, I get an error saying that G:AppsAccesstblYearEnd.txt is not a valid name, though this is where I would like the destination to be. If I drop the tblYearEnd.txt, it runs OK, but the table does not show up in the directory G:AppsAccess.

    I know that this can be done manually by selecting the table, then doing File/Export, etc. which works fine – I am trying to automate the process.
    I searched Help to determine if the command was set up incorrectly. Help shows examples for Import and Linked tables, but not Export, so I assume since I get no errors, it must be acceptable (wrong, but acceptable). I am running out of ideas.

    Any help is really appreciated.

    Steve

    Viewing 1 reply thread
    Author
    Replies
    • #726139

      Have you tried TransferText? From the Help….

      Example
      The following example exports the data from the Microsoft Access table External Report to the delimited text file April.doc by using the specification Standard Output:

      DoCmd.TransferText acExportDelim, “Standard Output”, _
      “External Report”, “C:TxtfilesApril.doc”

      • #726143

        I will give that a try. I was tunnel-visioned on the TransferDatabase, because I had used it successfully for an Import, so therefore it must work as well for Export, right??

      • #726144

        I will give that a try. I was tunnel-visioned on the TransferDatabase, because I had used it successfully for an Import, so therefore it must work as well for Export, right??

      • #726147

        That did the trick. Thanks for such a quick response. I should have asked the question sooner and saved myself the headache of trying to get the TransferDatabase to work.

        bravo

        Steve

      • #726148

        That did the trick. Thanks for such a quick response. I should have asked the question sooner and saved myself the headache of trying to get the TransferDatabase to work.

        bravo

        Steve

    • #726140

      Have you tried TransferText? From the Help….

      Example
      The following example exports the data from the Microsoft Access table External Report to the delimited text file April.doc by using the specification Standard Output:

      DoCmd.TransferText acExportDelim, “Standard Output”, _
      “External Report”, “C:TxtfilesApril.doc”

    Viewing 1 reply thread
    Reply To: Exporting a table using DoCmd (XP SP-2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: