ACC: How to Print a Variable-Length Character String

ID: Q119076


The information in this article applies to:


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          : RptOthr 
Version           : 1.0 1.1 2.0 7.0 97
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: April 6, 1999