Microsoft KB Archive/119076

= ACC: How to Print a Variable-Length Character String =

Article ID: 119076

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q119076



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



SUMMARY
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:

 Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0). Create a blank, new report based on the Customers table.  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   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  Set the page header section's Height property to 0.25 in.</li>  Preview the report. Note that the report looks as follows:

<pre class="fixed_text">     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 </li></ol>

<div class="references_section">