Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002

    Unanswered: How to get space inside textbox or combobox?

    How to avoid trimming on textbox and combobox? I have a problem if the input is space only. If I enter a space into a textbox (or 2 spaces, or even 3 spaces or more), Access will remove my space, and the value stored in the textbox or combobox is Null...

    Is there a way to avoid this?

  2. #2
    Join Date
    Oct 2001
    Use at your own risk - not sure what the side effects are.

    Option Compare Database
    Dim sString As String

    Private Sub TestBox_AfterUpdate()
    If Nz(sString) > "" Then
    Me!TestBox = sString
    sString = ""
    End If
    End Sub

    Private Sub TestBox_BeforeUpdate(Cancel As Integer)
    If Nz(Me!TestBox.Text) > "" Then
    If Left(Me!TestBox.Text, 1) = Chr(32) Or Right(Me!TestBoxTest.Text, 1) = Chr(32) Then
    sString = Me!TestBox.Text
    End If
    End If
    End Sub

Posting Permissions

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