Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exporting a table using DoCmd (XP SP-2)

    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

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Exporting a table using DoCmd (XP SP-2)

    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"

  3. #3
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Exporting a table using DoCmd (XP SP-2)

    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??

  4. #4
    Star Lounger
    Join Date
    Aug 2002
    Location
    Des Moines, Iowa, USA
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Exporting a table using DoCmd (XP SP-2)

    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.

    <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>

    Steve

Posting Permissions

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