Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Box 1

Status
Not open for further replies.

clo

Programmer
Apr 23, 2001
9
CA
I have a Text Box control on a form. The text box is multiple line (when the enter key is pressed, another line is generated) and is related (source) to a memo field on a table. All records doesn't have the same number of line entries. Entries are different and typed by the user (that is why a haven't used a List Box). For example, a record can count 6 lines and another one none... I have a report based on the table. The text box is shown on multiple line (has it appear on the form).

Here is my question: I am wondering if there is a property like the "Indexdata" of the list box in order to get each line entry to concatenate all lines and show the text box on only one line ? If so, where can I write the code to do this on the report? If it is not possible, is there another method to do this? How can I do?

Any suggestion will be welcome!
 
Nope, you would need to search through the text and replace carriage return line feeds to nothing. That is if the user has actually put cr /lf in. The text box will word wrap just like the text box I am typing into, so it may appear to be on different lines when it really isnt. Peter Meachem
peter@accuflight.com
 
I have a little function I modified to strip returns, the original formula was designed to find a string of characters and replace it with something else. But when you searched for a return it stripped the carriage feed but left that square box thing in the converted data. So here's my modified function.


Function fstrStripReturn(ByVal sInString As String, _
sFindString As String, _
sReplaceString As String) As String
Dim iSpot As Integer, iCtr As Integer
Dim iCount As Integer

iCount = Len(sInString)
For iCtr = 1 To iCount
iSpot = InStr(1, sInString, sFindString)
If iSpot > 0 Then
sInString = Left(sInString, iSpot - 1) & _
sReplaceString & _
Mid(sInString, iSpot + 1 + Len(sFindString))
Else
Exit For
End If
Next
fstrStripReturn = sInString

End Function

Sample Usage:

ControlName = fstrStripReturn(DummyControl, Chr(13), &quot;<BR>&quot;)

So what I did was have a dummy entry control for people to edit the record and then store the data without the return. I used &quot;<BR>&quot; a la HTML and then when the record is reloaded used the author's original function to restore the data in the dummy control with the returns. Here's that function (the original whom I do not know the author of):

Function fstrTran(ByVal sInString As String, _
sFindString As String, _
sReplaceString As String) As String
Dim iSpot As Integer, iCtr As Integer
Dim iCount As Integer

iCount = Len(sInString)
For iCtr = 1 To iCount
iSpot = InStr(1, sInString, sFindString)
If iSpot > 0 Then
sInString = Left(sInString, iSpot - 1) & _
sReplaceString & _
Mid(sInString, iSpot + Len(sFindString))
Else
Exit For
End If
Next
fstrTran = sInString

End Function

Sample Usage:
DummyControl = fstrTran(ControlName, &quot;<BR>&quot;, Chr(13) + Chr(10))

Hopefully that is not too confusing! Let me know if you have any questions!

Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top