I have Comments field in my db that can contain many lines of text and when
it displays in the report the textbox grow extensively. How can I limit the
amount that the text box grows, OR limit the amount of text that is
retrieved in my query, i.e., I only want to display 10-15 lines out of
potentially 80-100.
Thanks
DeanYou can try to show only the first N characters doing it in your SQL
sentence or in the Cell Expresion:
IN SQL:
SELECT substring(YourtextField, 1, N) as Comments, ... FROM YourTable
IN Your cell expresion:
= Mid(Fields!YourField.Value, 1, N)
Does it help?
"Dean" <deanl144@.hotmail.com.nospam> escribió en el mensaje
news:%23M8giJhIIHA.5764@.TK2MSFTNGP06.phx.gbl...
>I have Comments field in my db that can contain many lines of text and when
>it displays in the report the textbox grow extensively. How can I limit the
>amount that the text box grows, OR limit the amount of text that is
>retrieved in my query, i.e., I only want to display 10-15 lines out of
>potentially 80-100.
> Thanks
> Dean
>|||On Nov 8, 9:19 am, "Dean" <deanl...@.hotmail.com.nospam> wrote:
> I have Comments field in my db that can contain many lines of text and when
> it displays in the report the textbox grow extensively. How can I limit the
> amount that the text box grows, OR limit the amount of text that is
> retrieved in my query, i.e., I only want to display 10-15 lines out of
> potentially 80-100.
> Thanks
> Dean
You could create a custom code that counts the carriage return
characters (vbCr, vbLf, vbCrLf depending on your encoding), and if
there are more than 10 in your input string, truncate it using the
Left function
Off the top of my head, it would look something like this:
Function TextTrimmer( txt As String ) As String
lineCount = 0
returnOffset = 1
While lineCount < 10 and returnOffset > 0
returnOffset = InStr( returnOffset+1, txt, vbCr)
lineCount = lineCount + 1
Wend
If returnOffset = 0 Then
' ran out of characters in the string before reaching 10 lines
return( txt )
Else
return( Left( txt, returnOffset-1 ) & "..." )
End If
End Function
Then in the textbox, use
=Code.TextTrimmer( Fields!ReallyLongText.Value )
-- Scott
Friday, March 9, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment