ACC97: How to Output Horizontal Lines on Report using OutputTo

Last reviewed: September 2, 1997
Article ID: Q170980
The information in this article applies to:
  • Microsoft Access 97

SUMMARY

Moderate: Requires basic macro, coding, and interoperability skills.

If you output the data in a report, the only controls that are included in the output file are text boxes (for .xls output files), or text boxes and labels (for .rtf, .txt, and .html output files). All other controls are ignored.

This article demonstrates how you can output the lines in your report by using the String() function.

MORE INFORMATION

The String() function returns the number of characters you specify for the string. To be able to output lines in a report using the OutputTo() function, use the String() function as follows:

  1. Open the report to which you want to add the lines in Design view.

  2. Create an unbound text box, and place it on the report in the position where you want to have the line appear. Widen the text box to the length you would like the line to be.

    NOTE: Delete the label portion of the text box if you do not want it to appear in the report.

  3. In the ControlSource property of the text box, type the following

          =String(<number>, <character>)
    

    where <number> is the length of the string and <character> is the repeating character string you are using.

    For example, to print a total of 125 dashes (-)across a report, type the following in the ControlSource property:

           =String(125,"-")
    

  4. Switch the report to Preview to make sure the line appears where you want it.

  5. Close and save the report.

  6. Create a module and type the following procedure:

          Sub MyOutPutTo()
    
             DoCmd.OutputTo acOutputReport, "<ReportName>", acFormatTXT, _
             "C:\<OutputFileName>"
    
          End Sub
    
       NOTE: For <ReportName>, substitute the name of your report, and for
       <OutPutFileName>, substitute the name for your output file.
    
    

  7. Run the procedure from the Debug window. Note that the report is output with the lines.

REFERENCES

For more information about the String() function, search the Help Index for "String function," or ask the Microsoft Access 97 Office Assistant.

Keywords          : OtpGnrl kbprg
Version           : 97
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.