Results 1 to 3 of 3
  1. #1
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82

    Export Fixed Width txt File with dynamic header and footer

    Hi all



    I am looking for the best way to export a query to a fixed width txt file that Will always have a dynamic Header and Footer.

    The header and footer will pull data from textboxes on a form.

    The only option I had looked into was to export 3 txt files and concatenate them with Command Prompt but the I do not have access to this function on my computer.

    Thanks

    Craig

  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,902
    The only way I know to dynamically set header and footer of text file is to open text file object in VBA and write one line at a time.

    Bing: VBA read write text file
    http://www.tek-tips.com/faqs.cfm?fid=3767
    http://www.excel-easy.com/vba/exampl...text-file.html

    However, VBA can invoke the operating system Shell but I don't know if that can do your 'command prompt' approach. What would be the command to concatenate text files?
    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
    craig1988 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2014
    Posts
    82
    Hi June7

    Thanks for the pointers!!

    http://www.access-programmers.co.uk/forums/showthread.php?t=168031


    I am going to try this method...

    It seems wasy to follow and avoid using any Cmd Prompts.

    You were correct in saying that you would have to write one line at a time.

    <header>
    <table based on a query>
    <footer>

    I might even try testing this before the holidays!!

    Thanks

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

Similar Threads

  1. Replies: 2
    Last Post: 10-15-2014, 02:23 AM
  2. 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
  3. Replies: 5
    Last Post: 02-20-2011, 08:22 PM
  4. export query to fixed width text
    By eladz949 in forum Import/Export Data
    Replies: 1
    Last Post: 02-08-2011, 07:28 AM
  5. export query to fixed width text
    By eladz949 in forum Import/Export Data
    Replies: 5
    Last Post: 01-01-2011, 03:28 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