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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi Line Text Box

Status
Not open for further replies.

SaturnSeven

Programmer
Aug 4, 2005
40
GB
I would like to use a multi line text box on a Access form. I.e. using Ctrl+Enter to write on the next line of the text box.
How can I split the text box values to loose the square characture for the Ctrl+Enter in to say an array.
 
You can use Replace. The square is probably Chr(13) + Chr(10) or just Chr(13), depending where the data is coming from.
 
If i'm understanding you correctly, you mean you need to enter multiple values against one record so you are using a multiline textbox and seperating by a character return?

If this is the case, would it not be easier to store these multiple values in another table and link the multiple records to the single one rather than using a memo field?

 
Hi! Not sure what you mean by
loose the square characture for the Ctrl+Enter in to say an array.

Far as stripping the Ctrl + Enter character from your text, that character is an ASCII code represented in VBA by either Chr$(13). The sub below will need one or two lines more, so hopefully another tech can ring in and complete it...
Code:
Private Sub txtMult_AfterUpdate()
'*****VARIABLE DECLARATION*****
Dim strMyOldText, strCleanText As String, intStringLength As Integer

On Error GoTo Err_txtMult_AfterUpdate

'Initialize variables
strMyOldText = Me.txtMult.Value
intStringLength = Len(strMyText)

'Confirm presence of text
    If intStringLength > 0 Then  'User entered some text
        For StripSquareChar = 1 To intStringLength
            If Mid(strMyText, StripSquareChar, 1) = Chr$(13) Then
                [!]'Character found, so delete the character from
                'the string, but not sure how.[/!]
            End If
        Next StripSquareChar
            Me.txtMult.Value = strMyText
    End If
Exit_txtMult_AfterUpdate:
    Exit Sub
Err_txtMult_AfterUpdate:
    MsgBox Err.Description
    Resume Exit_txtMult_AfterUpdate
End Sub

Live once die twice; live twice die once.
 
Not quite Steve3110, the form is used to select various criteria and when the user clicks the 'Go'button an SQL statement is created from the criteria on the form and executed in a DoCmdRunSQL line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top