Fill in rest of field with dot leaders....


G

Guest

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.

Michele
 
Ad

Advertisements

C

Cheryl Fischer

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.
 
C

Cheryl Fischer

I should have known that you would have a solution for this, Stephen!!

--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Stephen Lebans said:
Cheryl there is also a solution for report's here that could be easily
modified to produce the desired results.:
http://www.lebans.com/leaderdots.htm
LeaderDots.zip is a database containing functions to allow a user to
fill in the space between 2 controls with leading dots.

NEW - Feb. 15/2000 Ver 2.0. You can now use the Alignment property for
both the Left and Right Columns. Fix formatting Bug on long lines.

New Jan. 02/2001 A "real" Phone Book Report based on a modified version
of LeaderDots. Created by Chad Edie. Really Sharp!
TelephonePhoneBook.zip

Version 1.0 includes 2 functions. One for Single output lines and one
for Multiple output lines

Produce leading dots between 2 strings.
Like you see on Menu's etc. For example:
Hamburger..........$3.99
HotDog...............$2.99
The Singleline version supports Left, Right
and Center Alignments for the
Left Column. The MultiLine version only supports Left Alignment.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Cheryl Fischer said:
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.
 
S

Stephen Lebans

Cheryl there is also a solution for report's here that could be easily
modified to produce the desired results.:
http://www.lebans.com/leaderdots.htm
LeaderDots.zip is a database containing functions to allow a user to
fill in the space between 2 controls with leading dots.

NEW - Feb. 15/2000 Ver 2.0. You can now use the Alignment property for
both the Left and Right Columns. Fix formatting Bug on long lines.

New Jan. 02/2001 A "real" Phone Book Report based on a modified version
of LeaderDots. Created by Chad Edie. Really Sharp!
TelephonePhoneBook.zip

Version 1.0 includes 2 functions. One for Single output lines and one
for Multiple output lines

Produce leading dots between 2 strings.
Like you see on Menu's etc. For example:
Hamburger..........$3.99
HotDog...............$2.99
The Singleline version supports Left, Right
and Center Alignments for the
Left Column. The MultiLine version only supports Left Alignment.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Cheryl Fischer said:
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.
 
C

Cheryl Fischer

Hit send button too soon ...

And, thanks!

--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Stephen Lebans said:
Cheryl there is also a solution for report's here that could be easily
modified to produce the desired results.:
http://www.lebans.com/leaderdots.htm
LeaderDots.zip is a database containing functions to allow a user to
fill in the space between 2 controls with leading dots.

NEW - Feb. 15/2000 Ver 2.0. You can now use the Alignment property for
both the Left and Right Columns. Fix formatting Bug on long lines.

New Jan. 02/2001 A "real" Phone Book Report based on a modified version
of LeaderDots. Created by Chad Edie. Really Sharp!
TelephonePhoneBook.zip

Version 1.0 includes 2 functions. One for Single output lines and one
for Multiple output lines

Produce leading dots between 2 strings.
Like you see on Menu's etc. For example:
Hamburger..........$3.99
HotDog...............$2.99
The Singleline version supports Left, Right
and Center Alignments for the
Left Column. The MultiLine version only supports Left Alignment.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Cheryl Fischer said:
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.
 
G

Guest

I tried to just copy the control that had the dotleaders in it and pasted it into my form. It only showed up where I put the control and the length was only as long as the control was. It worked on your report, why not mine?
 
Ad

Advertisements

S

Stephen Lebans

Did you look at the code behind the Report?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Michele said:
I tried to just copy the control that had the dotleaders in it and
pasted it into my form. It only showed up where I put the control and
the length was only as long as the control was. It worked on your
report, why not mine?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Use of a dot leader 1
filling fields 10
Filling fields 6
fill in fields 1
Filling fields 1
Fields to be Filled in 7
automatically fill in fields 3
Filling Fields Automatically 1

Top