ACC: How to Print a Variable-Length Character String

Last reviewed: April 2, 1997
Article ID: Q119076
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SUMMARY

Novice: Requires knowledge of the user interface on single-user computers.

This article describes how you can print a variable-length character string. You can use this method to print a dotted line (or a line composed of the character of your choice) between two fields of variable length on a report.

MORE INFORMATION

The following example demonstrates how to print a dotted line between a variable-length name field and a phone number field:

  1. Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0).

  2. Create a blank, new report based on the Customers table.

  3. Create two unbound text boxes in the report's detail section. Modify their properties as described below so that the first text box will display the name and the dotted line, and the second text box will display the phone number.

    NOTE: In the following example, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this example.

          Text Box 1
          --------------------------------------------------------------
          Name: NameDotString
    

          NOTE: In Microsoft Access version 1.x, the Name property is called
          the ControlName property.
    

          ControlSource: =[CompanyName] & _
    
                        ".............................................._
                         .............................................."
    
          NOTE: In Microsoft Access versions 1.x and 2.0, type a space in
          [Company Name].
    
          CanGrow: No
          CanShrink: No
          Left: 0.3 in
          Top: 0.08 in
          Width: 2.8 in
          Height: 0.17 in
          FontName: Arial
          FontSize: 8
    
          Text Box 2
          --------------------
          Name: Phone
          ControlSource: Phone
          Left: 3.1 in
          Top: 0.08 in
          FontName: Arial
          FontSize: 8
    
    

  4. Create two label controls with the following properties in the report's page header section:

          Label 1
          ----------------------
          Name: CompanyNameLabel
          Caption: Company Name
          Left: 0.3 in
          Top: 0.08 in
          FontName: Arial
          FontSize: 8
          FontWeight: Bold
          FontUnderline: Yes
    

          Label 2
          ------------------
          Name: PhoneLabel
          Caption: Phone
          Left: 3.1 in
          Top: 0.08 in
          FontName: Arial
          FontSize: 8
          FontWeight: Bold
          FontUnderline: Yes
    

  5. Set the page header section's Height property to 0.25 in.

  6. Preview the report. Note that the report looks as follows:

          Company Name                             Phone
          ------------                             -----
    
          Alfreds Futterkiste......................030-0074321
    
          Ana Trujillo Emparedados y helados.......(5) 555-4729
    
          Antonio Moreno Taqueria..................(5) 555-3932
    
          Around the Horn..........................(71) 555-8248
    
    

REFERENCES

For more information about reports, search the Help Index for "Designing reports," or ask the Microsoft Access 97 Office Assistant.


Additional query words: fill pad
Keywords : kbusage RptsLyt
Version : 1.0 1.1 2.0 7.0 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: April 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.