Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2004
    Location
    Bulgaria
    Posts
    11

    Unanswered: Export query as *.txt

    I want to export query result as text file, but in a vertical order like this:
    query:
    name; age;city;addres;

    text file:
    name
    age
    city
    addres

    I can't do this in regular Access tools

    Can somebody help me?

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Use a query to format the output as a single field, catenated with Chr$(13) & Chr$(10) and then export the query to a text file.
    Ken

    Maverick Software Design

    (847) 864-3600 x2

  3. #3
    Join Date
    Feb 2004
    Location
    Bulgaria
    Posts
    11
    Originally posted by PracticalProgram
    Use a query to format the output as a single field, catenated with Chr$(13) & Chr$(10) and then export the query to a text file.
    Thank you Ken!
    Please,
    tell me more about this. I can't find what means "Chr$(13) & Chr$(10)"
    in Help files. There is info only about Chr function.

  4. #4
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Chr$(13) is a carriage return
    Chr$(10) is a line feed

    So,

    [name] & Chr$(13) & Chr$(10) & [age] & Chr$(13) & Chr$(10) & [city] & Chr$(13) & Chr$(10) & [addres]

    will yield

    [name]
    [age]
    [city]
    [address]
    Ken

    Maverick Software Design

    (847) 864-3600 x2

  5. #5
    Join Date
    Feb 2004
    Location
    Bulgaria
    Posts
    11
    Hello Ken,
    I do a mistake somewhere
    When I type your text in a query, as result i see only first field
    Whet I type only- [name] & Chr$(13) & [age] & Chr$(13) & [city] .....etc.
    and copy to Excel it work.

  6. #6
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243
    Originally posted by ivail
    Hello Ken,
    I do a mistake somewhere
    When I type your text in a query, as result i see only first field
    Whet I type only- [name] & Chr$(13) & [age] & Chr$(13) & [city] .....etc.
    and copy to Excel it work.

    Instead of the combination 'Chr$(13) & Chr$(10)' you can also use 'vbCrLf' (This is VB for Carriage Return Line Feed)

  7. #7
    Join Date
    Feb 2004
    Location
    Bulgaria
    Posts
    11

    Red face

    It's return message
    "Undefined funktion 'vbCrLf' in expression."

Posting Permissions

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