Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove Excess Spaces from a Text String? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8

    I have looked at Trim and Replace without success.

    What is the code to remove a variable number of extra spaces from a Form Text Box control in After_Update Event?

    <pre>From:
    Ken Smith / Mark Brown
    To:
    Ken Smith / Mark Brown
    </pre>


    Thanks, John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove Excess Spaces from a Text String? (a2k (9.0.6926) SP-3 Jet 4.0

    Try this, substituting the correct name:

    Private Sub TextBox1_AfterUpdate()
    Dim strText As String
    If Not IsNull(Me.TextBox1) Then
    strText = Trim(Me.TextBox1)
    Do While InStr(strText, Space(2)) > 0
    strText = Replace(strText, Space(2), Space(1))
    Loop
    Me.TextBox1 = strText
    End If
    End Sub

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove Excess Spaces from a Text String? (a2k (9.0.6926) SP-3 Jet 4.0

    Your solution seems to be more straight forward than Remove Extra Spaces Version: 2003 (11.0)

    http://www.utteraccess.com/forums/showthre...sb=5&o=&fpart=1

    Thanks, John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •