Results 1 to 2 of 2
  1. #1
    Nobody is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8

    VBA: TransferText Method Export Specification string limitation?

    I'm trying to confirm my suspicion that the export specification is only allowed to be ¿54? characters long when used in the transfertext method in exporting a query to a file from access.

    In my case, I made a module to run down the list of queries I need to run periodically (50+ queries) and made export specifications for each, using the default name '<query> Export Specification' for use in the transfertext method... and it errors on the queries with long titles (query name >43 characters)

    Checking with microsoft I didn't see this to be the case,
    A string expression that's the name of an import or export specification you've created and saved in the current database.
    and I just need to know if I HAVE to shorten the query name, or use a different naming convention for the export specifications. Or maybe I'm off-base?

    Code:
        DoCmd.TransferText _
            transfertype:=acExportDelim, _
            specificationname:=sQuery & " Export Specification", _
            tablename:=sQuery, _
            Filename:=CurrentProject.Path & "\Exports\" & sQuery & ".csv", _
            hasfieldnames:=True
        DoCmd.Close
    Hope that's clear!

    TIA

  2. #2
    Nobody is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8
    I edited the code to the following and it works...
    Code:
        DoCmd.TransferText _
            transfertype:=acExportDelim, _
            specificationname:=Left(sQuery, 43) & " Export Specification", _
            tablename:=sQuery, _
            Filename:=CurrentProject.Path & "\Exports\" & sQuery & ".csv", _
            hasfieldnames:=True
        DoCmd.Close
    And based on my test of a long query title, Access2007 does, in fact, cut off anything after 43 characters for the default export specification title.

    <The more you know>

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

Similar Threads

  1. TransferText problem
    By rossib in forum Import/Export Data
    Replies: 1
    Last Post: 12-17-2009, 04:57 PM
  2. Modifying an import specification
    By ronzul in forum Import/Export Data
    Replies: 3
    Last Post: 11-12-2009, 05:03 AM
  3. Replies: 1
    Last Post: 11-10-2009, 03:03 PM
  4. DoCmd.TransferText only if file is new
    By Coolpapabell in forum Programming
    Replies: 1
    Last Post: 10-14-2009, 01:57 AM
  5. import text specification
    By brunoylupe in forum Import/Export Data
    Replies: 12
    Last Post: 08-09-2009, 04:47 PM

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