Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    2

    Unanswered: TransferText not working

    Hi,

    I'm trying to export a query to a textfile by running script with WSH, but all I'm getting is an error (MSAccess: Query must have at least one destination field.)

    This is the code I'm using:

    Set objAccess = CreateObject("Access.Application.9")

    With objAccess
    .OpenCurrentDatabase dbName
    .DoCmd.TransferText acExportDelim, , strQuery, strExportFile
    .CloseCurrentDatabase
    .Quit
    End With

    Set objAccess = Nothing

    strQuery is the name of the query in Access, strExport is the full path and name of the .txt file I want to export to.

    Any ideas?

    Thanks!
    Michiel

  2. #2
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    whenever I se that message it means I am running an append query and have desigantes the destination tables fields

  3. #3
    Join Date
    Jan 2004
    Posts
    2
    Hi,

    the query is a SELECT, but if I try the same code with a normal table and try to export that, it doesn't work either.
    The file I'm trying to write to exists, is writable and empty. I still don't understand the error message...

    Michiel

Posting Permissions

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