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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Export column to text file (and modify file) (A2k)

    Author
    Topic
    #427169

    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

    Viewing 0 reply threads
    Author
    Replies
    • #989126

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

      • #989127

        Hans,
        DoCmd.TransferText works just fine, thanks for letting me know it’s an option. How do I export without quotation marks?

        • #989129

          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

    Viewing 0 reply threads
    Reply To: Export column to text file (and modify file) (A2k)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: