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:
- 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
- On the File menu, click Close and Return to Microsoft Access.
- On the View menu, click Form View.
Note that Field4 contains:
John.....................................Doe