I have an old (really old!) piece of code that may work for you:
1. Paste following code in a Public Module:
Public Function PadStr(strField As String, _
strChar As String, intLenStr As Integer, _
intpadTo As Integer, strWhere As String) As String
' strField is the string which is to be padded - may be a field name or an
expression
' strChar is the padding string; i.e., " ", "0", etc.
' intLenStr is the actual trimmed length of the string or expression to be
padded
' intPadTo is the desired string length
' strWhere is "L" for pad on the left, "R" for pad on the right
' Get the diff between string length and desired length
Dim intPadDiff As Integer
intPadDiff = intpadTo - intLenStr
' Determine how to pad based on the length of the string passed
If intPadDiff < 0 Then ' String length is greater than desired length
PadStr = Left(strField, intpadTo)
Else
If strWhere = "L" Then
PadStr = String(intPadDiff, strChar) & strField
Else
PadStr = strField & String(intPadDiff, strChar)
End If
End If
End Function
2. In the Control Source property of the text box on your report, insert
the following:
=PadStr([LineItem], ".", Len(Trim([LineItem])), 200, "R")
3. Make sure that the text box on your report has a different name from the
name of the field you are using
4. You will need to experiment with the number representing the padded
length of the string (200 in the sample function call above), to accommodate
variable width fonts. When I have had to use this code for dot leaders, I
set a rather high number and then set the Can Grow property of the text box
to 'No' so that the dots will not wrap.
hth
--
Cheryl Fischer
Law/Sys Associates
Houston, TX
Michele said:
I have an Invoice form that has several line items. Each item is so
long.
I would like to fill any remaining space after typing in the item with dot
leaders (.......). Actually, it's more important that it's on the Report
component so that it prints out on the Invoice. Is this possible? Thanks
for your help.