• ASCII Reports (97)

    Author
    Topic
    #361410

    In Access, it is possible to create a report that has no formatting at all other than line breaks? I want to use the report to generate an ASCII file to import into another problem. It is inconvenient to use a query for this purpose because I need multiple lines for each record.

    Alternatively, if there is a way to insert returns into a query so that one record can generate multiple lines when the query is saved as a TXT file, that too would work.

    Right now, I am using a query that writes each record to a single line and then using a Word macro to clean up the text and insert the necessary returns. That works great for me, and I’m the only one using the database right now, but I want to give it to some others to use and I don’t want them to have to run the Word macro.

    Ronny

    Viewing 1 reply thread
    Author
    Replies
    • #546302

      By definition, a record is a single row in a query, which translates to a single line in a file, so what do you mean by multiple lines for each record?

      It sounds like you would be better off doing direct file I/O from a recordset using the Open statement and writing parts of each record directly into a line in the text file.

      • #546816

        >By definition, a record is a single row in a query, which translates to a single line
        >in a file, so what do you mean by multiple lines for each record?

        I know that a single line in a query always equals a record. What I’m wondering is if it is possible for that line to contain “new line” characters that get treated as a return when that line is written out to a text file. If that is possible, then the query would have one “line” per record that would translate into multiple lines when the query was saved as a text file.

        I accomplish this indirectly now by writing including character strings in the query that a Word macro searches on and replaces with returns. I just want to skip using the macro.

        Ronny

    • #546666

      If you are intent on doing this with reports, you can do the following:

      1. Create a report with no ReportHeader, PageHeader, GroupHeader, GroupFooter, PageFooter or ReportFooter (i.e. only a Detail section). Map your fields in the detail section so you get multiple rows of data to suit your purposes. Save this report.

      2. There is a toolbar button that you can use to run the report to Word or Excel. You can add an entry to this toolbar button to output to Notepad. First, right-click on the Database toolbar and choose Customize from the shortcut menu. Click on the Commands tab and you’ll see all of the available commands that can be added to your menus and toolbars. In the Categories list box, select Tools. Now, locate the Output To Notepad button in the Commands list box and drag it to the desired position on the Database toolbar. Then click Close.

      Now, whenever you want to create your ASCII file, simply click on the report name, then click the dropdown to the right of the OutputTo toolbar button and choose Output To Notepad!

      • #546817

        Sounds good. I’ll give it a shot. Thanks.

        Ronny

    Viewing 1 reply thread
    Reply To: ASCII Reports (97)

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

    Your information: