Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Export column to text file (and modify file) (A2k)

    I have a very simple query, that creates a list of all social security numbers that meet certain criteria. I copy the field (SSN) and paste in a text document. I then have to delete the first line in the text file (where the field name is) so that the text file immediately begins with the first SSN. Example:

    What I get
    -------------
    SSN
    999999999
    888888888

    What I want
    ---------------
    999999999
    888888888

    and so on, and so on....how to do with vba? The file is located under C:/Database/SSN.txt

    This file is important to keep updated, because it serves as a picklist for an oracle-driven database (unfortunately, there is no way of directly linking the Access front end with it), so manual updates must be ran, saved as excel files, and then update queries be run.

    Off of my tangent now....I think my problem is fairly straightforward, TIA
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Export column to text file (and modify file) (A2k)

    You can specify whether you want field names if you use File | Export... or the code equivalent DoCmd.TransferText.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Export column to text file (and modify file) (

    Hans,
    DoCmd.TransferText works just fine, thanks for letting me know it's an option. How do I export without quotation marks?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Export column to text file (and modify file) (

    Start exporting manually (using File | Export...)
    The Text Export Wizard lets you specify whether you want ", ' or nothing as text indicator, plus several other settings.
    Just before clicking Finish, click Advanced...
    Check the settings, then click Save As...
    You can save the settings as a specification (accept the name proposed by Access or modify it as you like)
    You don't actually need click Finish when you're back in the Wizard.

    The second argument of DoCmd.TransferText is SpecificationName. If you provide the name of the specification you just saved, the export will use those settings. For example:

    DoCmd.TransferText acExportDelim, "MyExportSpec", "qrySSN", "C:TextSSN.txt", False

  5. #5
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Export column to text file (and modify file) (

    <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    Thanks Hans.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

Posting Permissions

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