Microsoft KB Archive/210356

= ACC2000: How to Create a Dot Leader Between Fields =

Article ID: 210356

Article Last Modified on 4/22/2003

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q210356



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

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



SUMMARY
This article shows you how to create a sample user-defined Visual Basic for Applications function that you can use to create lists of fields with dot leaders between the items. For example, given the items "John" and "Doe," the function creates the following:

John.....................................Doe



MORE INFORMATION
To create a dot leader (or any other leader) between fields, you must use a function to make sure that the field columns line up. The Dots function demonstrates how to create dot leaders between fields.

NOTE: For multiple lines of characters to line up correctly, you must use a fixed-width font (such as Courier) in the text boxes.

The Dots Function
 Start Microsoft Access 2000, and then open any database. In the Database window, click Forms, and then click New. In the New Form dialog box, click Design View, and then click OK.  Add three text box controls with the following properties to the form: Name: Field0 DefaultValue: "John"

Name: Field2 DefaultValue: "Doe"

Name: Field4 Width: 2.5" ControlSource: =[Field0] & Dots([Field2]) & [Field2]                     Create a new module, and then type the following line in the Declarations section:  Option Explicit                      Type the following procedure:  Function Dots (ByVal Title)   ' Set LineLen to the gap you want (in characters) between the   ' Field0 data and the beginning of the Field2 data.   Const LineLen = 40

' Set FillChar to the leader character you want to use between the ' fields. Const FillChar = "."

Dots = String$(LineLen - Len(Title), ".") End Function </li> On the File menu, click Close and Return to Microsoft Access.</li> On the View menu, click Form View. Note that Field4 contains:

John.....................................Doe

</li></ol>

<div class="references_section">