A question on auto growth textbox.

  • Thread starter Thread starter Aldred@office
  • Start date Start date
A

Aldred@office

Hi all,
I had an algorithm which generate a pretty long string. An enlarged textbox
which can contain a several lines of text was created. Now the string will
be truncated into several pieces that is able to fit into the width of the
textbox. However, Access 2007 truncate them like this:

100001/100023/14499
1/157621/

How could I make Access to truncate the string like this
100001/100023/
144991/157621/

Thanks all.
 
In the after update event, count the characters, divide by 2 (or more), and
add a carriage return (vbCrLf) to each n characters in the string. The
following code will count characters, excluding spaces. You will need to
create a form level variable to replace [Text116] in the code, then use that
variable in your division:

Private Sub txtMyMemo_AfterUpdate()

Dim lngIndex As Long
Dim lngCharCount As Long
For lngIndex = 1 To Len(Me.txtMyMemo)
If Mid$(Me.txtMyMemo, lngIndex, 1) <> " " Then
lngCharCount = lngCharCount + 1
End If
Next lngIndex
Me.Text116 = lngCharCount

End Sub
 
Thanks Arvin, however, there is a problem that the font is having different
width in each character. For example i and m has different width for the
given font so this solution might not work.

Arvin Meyer said:
In the after update event, count the characters, divide by 2 (or more),
and add a carriage return (vbCrLf) to each n characters in the string. The
following code will count characters, excluding spaces. You will need to
create a form level variable to replace [Text116] in the code, then use
that variable in your division:

Private Sub txtMyMemo_AfterUpdate()

Dim lngIndex As Long
Dim lngCharCount As Long
For lngIndex = 1 To Len(Me.txtMyMemo)
If Mid$(Me.txtMyMemo, lngIndex, 1) <> " " Then
lngCharCount = lngCharCount + 1
End If
Next lngIndex
Me.Text116 = lngCharCount

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Aldred@office said:
Hi all,
I had an algorithm which generate a pretty long string. An enlarged
textbox
which can contain a several lines of text was created. Now the string
will
be truncated into several pieces that is able to fit into the width of
the
textbox. However, Access 2007 truncate them like this:

100001/100023/14499
1/157621/

How could I make Access to truncate the string like this
100001/100023/
144991/157621/

Thanks all.
 
Your only choice if that is a problem is to use Courier New or another fixed
width font.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Aldred@office said:
Thanks Arvin, however, there is a problem that the font is having
different width in each character. For example i and m has different
width for the given font so this solution might not work.

Arvin Meyer said:
In the after update event, count the characters, divide by 2 (or more),
and add a carriage return (vbCrLf) to each n characters in the string.
The following code will count characters, excluding spaces. You will need
to create a form level variable to replace [Text116] in the code, then
use that variable in your division:

Private Sub txtMyMemo_AfterUpdate()

Dim lngIndex As Long
Dim lngCharCount As Long
For lngIndex = 1 To Len(Me.txtMyMemo)
If Mid$(Me.txtMyMemo, lngIndex, 1) <> " " Then
lngCharCount = lngCharCount + 1
End If
Next lngIndex
Me.Text116 = lngCharCount

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


Aldred@office said:
Hi all,
I had an algorithm which generate a pretty long string. An enlarged
textbox
which can contain a several lines of text was created. Now the string
will
be truncated into several pieces that is able to fit into the width of
the
textbox. However, Access 2007 truncate them like this:

100001/100023/14499
1/157621/

How could I make Access to truncate the string like this
100001/100023/
144991/157621/

Thanks all.
 
If it is the only option, then I think I have to follow.

Thanks.

Arvin Meyer said:
Your only choice if that is a problem is to use Courier New or another
fixed width font.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Aldred@office said:
Thanks Arvin, however, there is a problem that the font is having
different width in each character. For example i and m has different
width for the given font so this solution might not work.

Arvin Meyer said:
In the after update event, count the characters, divide by 2 (or more),
and add a carriage return (vbCrLf) to each n characters in the string.
The following code will count characters, excluding spaces. You will
need to create a form level variable to replace [Text116] in the code,
then use that variable in your division:

Private Sub txtMyMemo_AfterUpdate()

Dim lngIndex As Long
Dim lngCharCount As Long
For lngIndex = 1 To Len(Me.txtMyMemo)
If Mid$(Me.txtMyMemo, lngIndex, 1) <> " " Then
lngCharCount = lngCharCount + 1
End If
Next lngIndex
Me.Text116 = lngCharCount

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Aldred@office" <aldred> wrote in message
Hi all,
I had an algorithm which generate a pretty long string. An enlarged
textbox
which can contain a several lines of text was created. Now the string
will
be truncated into several pieces that is able to fit into the width of
the
textbox. However, Access 2007 truncate them like this:

100001/100023/14499
1/157621/

How could I make Access to truncate the string like this
100001/100023/
144991/157621/

Thanks all.
 
Back
Top