Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help - Export query to multiple text files

    I have a query that I need to export/create multiple text files based on the grouping of one field in the query.

    For example I would need to create two texts from the following data (all info for ABC in one file and all info for CDE in another)

    ABC DESC1
    ABC DESC2
    CDE DESC1
    CDE DESC2

    Is there a quick way to do this?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Help - Export query to multiple text files

    If you want to export a query to a text file for a particular grouping, just setup a parameter for the grouping required. When the query is run it will ask for the parameter and the resulting query result can be exported to a text file via the File/Export...

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help - Export query to multiple text files

    There are hundreds of these so a parameter query isn't the best solution in this case. I would like to have this process somehow completely automated without user intervention.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Help - Export query to multiple text files

    I would setup a form that contains a text field that is used for the grouping field, lets call it txtGroupField.
    Behind a button I would code the following:
    Read each group (this could be a query that is opened as a recordset)
    Set Forms!Formname!txtGroupField with the name of the group that has been read from the recordset
    Use DoCmd.TransterText for the query you have that has a parameter based upon Forms!Formname!txtGroupField, the filename could have the grouping field as part of it's name
    Loop

    I'm not too sure if you need to feed the parameter to the query in advance of the TransferText command.

    If you need any help in coding this, please post back.

Posting Permissions

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