Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2003
    Posts
    1

    Unanswered: Exporting a report to txt in MS ACCESS

    I need to export a report to txt.
    the problems i'm having is getting extra spaces after or before the data,
    i need it to be in a fixed number of charaters.

    i have search this and otehr forums, but couldn't find the solution.

    any ideas,

    thanks in advavce

  2. #2
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188

    Re: Exporting a report to txt in MS ACCESS

    Originally posted by frankgh
    I need to export a report to txt.
    the problems i'm having is getting extra spaces after or before the data,
    i need it to be in a fixed number of charaters.
    if you dont want extra spaces in data, try using TRIM() function in all text fields in the query that export your data.

    a fixed number of character for each field is a different thing that may need spaces to fill up some shorter records. in this case, some vb codes could work.

    hope this helps
    qha_vn

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    if you want a fixed length string of fieldLength characters, instead of [yourField] in the report, try:

    = left$([yourField] & string(fieldLength, " "), fieldLength)

    izy

  4. #4
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    6

    Re: Exporting a report to txt in MS ACCESS

    Originally posted by frankgh
    I need to export a report to txt.
    the problems i'm having is getting extra spaces after or before the data,
    i need it to be in a fixed number of charaters.

    i have search this and otehr forums, but couldn't find the solution.

    any ideas,

    thanks in advavce
    I assume you want to create a text file of fixed field lengths. If this is the case, use the file - export option in Access, and export the query or table that is the data source for the report. Use fixed width format, and use the advanced options in the export wizzard to save a specification.

    If you want to automate the process using VBA, on a button click event do the following:

    DoCmd.TransferText acImportFixed, "Specification Name", "Table or Query Name", "File Name", True

    Note , the True flag is for including or excluding field names. Set to TRUE if you have included field names in the export specification.

Posting Permissions

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