ACC2000: How to Output Horizontal Lines on Report Using OutputTo

ID: Q199055


The information in this article applies to:

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

This article applies to a Microsoft Access database (.mdb) and a Microsoft Access project (.adp).


SUMMARY

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 show you how you can use the String() function to output horizontal lines in your report.


MORE INFORMATION

The String() function returns the number of characters that you specify for the string. To output lines in a report by using the MyOutputTo() 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 that you are using.

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


  4. =String(125,"-")
  5. Switch the report to Preview to make sure the line appears where you want it.


  6. Close and save the report.


  7. 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.


  8. Run the procedure from the Immediate window. Note that the report is output with the lines.


Additional query words: inf


Keywords          : kbprg kbprint kbdta OtpGnrl 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: May 13, 1999