Results 1 to 3 of 3
  1. #1
    Keevo is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2014
    Posts
    3

    VBA Code to run a query and then export the query as a fixed width .txt file

    Hi All



    basically im trying to setup a click button that will export my query as a text file ( the text file will then be fixed width and i have already setup the specifications for this)

    i think i get how to complete the export part as below

    OutFilePath = "file location i want the data to be exported to"

    DoCmd.TransferText acExportFixed, "Welcome output query Export Specification", WelcomeOutput, OutFilePath, True

    i just dont know how to run the query and link it to the export

    Hope this makes sense and thanks in advance for any support provided.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The query doesn't have to 'run'. Just execute the TransferText command.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Keevo is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2014
    Posts
    3
    Takes a special kinda stupid to have the working code and not test it haha !!!

    i presumed it would be more complicated that it was

    thanks for your help

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

Similar Threads

  1. Export Fixed Width with No Line Breaks/Carriage Returns
    By jpfulton248 in forum Import/Export Data
    Replies: 5
    Last Post: 01-17-2014, 12:41 PM
  2. Replies: 5
    Last Post: 02-20-2011, 08:22 PM
  3. export query to fixed width text
    By eladz949 in forum Import/Export Data
    Replies: 1
    Last Post: 02-08-2011, 07:28 AM
  4. export query to fixed width text
    By eladz949 in forum Import/Export Data
    Replies: 5
    Last Post: 01-01-2011, 03:28 PM
  5. Formatting Fields and Fixed Width Exporting
    By Panman01 in forum Access
    Replies: 1
    Last Post: 05-22-2009, 09:32 AM

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